Count: 270 Time=14.71s (3971s) Lock=0.00s (0s) Rows=1.0 (270), fan[fan]@3hosts
SELECT count(*) AS count_all FROM `tuan_coupons` WHERE (operator_id in (N) and consume = N)
我在数据库里
SELECT * FROM `tuan_coupons` WHERE (operator_id IN ('N') AND consume = 'N')
可以查询,需要在N 加上单引号
结果operator_id 的值为0
不明白 WHERE (operator_id IN ('N') AND consume = 'N') 是神马意思
SELECT * FROM tuan_coupons t limit 10 查询operator_id为NULL或都有数值
但是我在mysql SQLyog Enterprise工具查询
单独用sql查询
SELECT t.operator_id,t.consume FROM tuan_coupons t WHERE (t.operator_id IN ('N') AND t.consume = 'N')
可能类型为int,'N'不代表字符串,只是泛指。。。
显示operator_id值为0
显示consume值也为0
还有,t.id in (a,b) ,改写为t.id=a or t.id=b 吧,多少in 结果与or的效率平衡。