SELECT * FROM t WHERE (id >10 and id <16 ) or (id>61 and id <65)
语句是有的, 不过运算量较大, 如下, 测试通过
SELECT * from (Select id,(@rowNum:=@rowNum+1) as rowNo From t_user, (Select (@rowNum :=0) ) b order by id asc) as a where mod(a.rowNo, 3) = 1Select id,(@rowNum:=@rowNum+1) as rowNo From t_user, (Select (@rowNum :=0) ) b order by id asc
这一句是先查结果集, 为每条纪录赋一个行号,
再从该结果集中对行号取余 mod(a.rowNo, 3) = 1
LZ的情况直接用, mod(a.rowNo, 50) = 1 就可以了, 不过无法保证效率
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)