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

sql or and 用法
select top 10 inside_id from dbo.baMdseInfo bm,dbo.baInfo ba
 where ba.code = bm.wordBook_ID and ba.tcode ='aaaa' and 
( INSIDE_ID LIKE '%006%' OR mdse_INFO LIKE '%006%'OR mdse_number LIKE '%006%')
 and (INSIDE_ID LIKE '%漫步机%' OR mdse_INFO LIKE '%漫步机%' OR mdse_number LIKE '%漫步机%')
-------------代码1-------------------
select top 10 inside_id ,mdse_info from dbo.baMdseInfo bm,dbo.baInfo ba where ba.code = bm.wordBook_ID 
and ba.tcode ='aaaa' and (INSIDE_ID LIKE '%漫步机%' OR bm.mdse_INFO LIKE '%漫步机% 'OR 
mdse_number LIKE '%漫步机%') and (INSIDE_ID LIKE '%006%' OR mdse_INFO LIKE '%006%' OR
 mdse_number LIKE '%006%')
-------------------------------代码2----------------
为什么代码1能够查询到内容而代码2却不能呢?


------解决方案--------------------
不可能吧,仔细看了,只是条件调了位置,其他完全相同

------解决方案--------------------
我看了你的代码,唯一区别代码2中
SQL code
bm.mdse_INFO