以下SQL查询不会返回任何结果:
SELECT *
FROM regtb
WHERE name LIKE 'Karnataka' OR
email LIKE 'Karnataka' OR
mobile LIKE 'Karnataka' OR
city LIKE 'Karnataka' OR
ocity LIKE 'Karnataka' AND
date BETWEEN '2015-04-07' AND '2015-04-11'
ORDER BY id
查询表具有以下结构:
ID
电子邮件
密码
命名
城市
移动
EXP
技能
UG
皮克
博士
日期
欢迎任何帮助
答案 0 :(得分:1)
试试这个:
SELECT * FROM regtb
WHERE (name LIKE 'Karnataka%' OR email LIKE 'Karnataka%'
OR mobile LIKE 'Karnataka%' OR city LIKE 'Karnataka%'
OR ocity LIKE 'Karnataka%')
and (date between '2015-04-07' and '2015-04-11')
ORDER BY id