日期:2014-05-18  浏览次数:20644 次

请问满足这样条件的Sql语句怎么写?谢谢
有这样一个Sql语句:
select   top   50   *   from   biz   where   shenhe=1   and   title   like   '%商机% '   or   main   like   '%商机% '   order   by   sj   desc
我要实现的结果是当title或者main字段满足筛选字段的情况下,shenhe字段都要为1,象我上面的Sql语句是错误的   结果中会包括shenhe为0的记录。
要实现这样结果的Sql语句应该怎样写呢?问题解决,马上给分   谢!

------解决方案--------------------
select top 50 * from biz where shenhe=1 and (title like '%商机% ' or main like '%商机% ' order by sj desc)

------解决方案--------------------
select top 50 * from biz where shenhe=1 and (title like '%商机% ' or main like '%商机% ') order by sj desc
------解决方案--------------------
select top 50 * from biz where shenhe=1 and (title like '%商机% ' or main like '%商机% ') order by sj desc