首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求一SQL语句,大家的帮助

2012-02-09 
求一SQL语句,在线等大家的帮助!select*fromdbwheremclikex%ormclikey%ormclikez%andrq2007-01-01 这样写

求一SQL语句,在线等大家的帮助!
select   *   from   db   where   mc   like   'x% '   or   mc   like   'y% '   or   mc   like   'z% '   and   rq> '2007-01-01 ';这样写出来的语句不执行and后面的条件,如何让OR   和AND条件同时执行呢?这语句应该怎么写?

[解决办法]
select * from db where (mc like 'x% ' or mc like 'y% ' or mc like 'z% ') and rq> '2007-01-01 '
[解决办法]

select * from db where mc like 'x% ' or mc like 'y% ' or mc like 'z% ' and rq> '2007-01-01 '

----------
select * from db where left(mc,1) in ( 'x ', 'y ', 'z ') and rq> '2007-01-01 '

热点排行