SQL運(yùn)算符 | 例子 | 實(shí)際查詢(xún)條件 | |
---|---|---|---|
eq | = | $map['id'] = array('eq',100); | 等效于:$map['id'] = 100; |
neq | != | $map['id'] = array('neq',100); | id != 100 |
gt | > | $map['id'] = array('gt',100); | id > 100 |
egt | >= | $map['id'] = array('egt',100); | id >= 100 |
lt | < | $map['id'] = array('lt',100); | id < 100 |
elt | <= | $map['id'] = array('elt',100); | id <= 100 |
like | like | $map<'username'> = array('like','Admin%'); | username like 'Admin%' |
between | between and | $map['id'] = array('between','1,8'); | id BETWEEN 1 AND 8 |
not between | not between and | $map['id'] = array('not between','1,8'); | id NOT BETWEEN 1 AND 8 |
in | in | $map['id'] = array('in','1,5,8'); | id in(1,5,8) |
not in | not in | $map['id'] = array('not in','1,5,8'); | id not in(1,5,8) |
and(默認(rèn)) | and | $map['id'] = array(array('gt',1),array('lt',10)); | (id > 1) AND (id < 10) |
or | or | $map['id'] = array(array('gt',3),array('lt',10), 'or'); | (id > 3) OR (id < 10) |
xor(異或) | xor | 兩個(gè)輸入中只有一個(gè)是true時(shí),結(jié)果為true,否則為false,例子略。 | 1 xor 1 = 0 |
exp | 綜合表達(dá)式 | $map['id'] = array('exp','in(1,3,8)'); | $map['id'] = array('in','1,3,8'); |
exp 不是一個(gè)運(yùn)算符,而是一個(gè)綜合表達(dá)式以支持更復(fù)雜的條件設(shè)置。exp 的操作條件不會(huì)被當(dāng)成字符串,可以使用任何 SQL 支持的語(yǔ)法,包括使用函數(shù)和字段名稱(chēng)。
發(fā)表評(píng)論