select c.name,sup.name,s.name from client c,supplier sup,sellor s where c.id in (select o.clientId from t_order o where o.clientId=c.id and o.supplierId=sup.id and o.sellorId=s.id ) 
and  (c.name='某某某' or sup.name='某某某' or s.name='某某某')
上面的语句为什么查不出结果呢?明明client这张表里面有这个名字为什么查询不出来?

解决方案 »

  1.   

    -- 查不出来的原因很多:
    -- *(01) 你的where条件限制了
    -- *(02) 数据表面上符合你的where条件要求,但实际却不符合你的where条件要求
    -- (例如:字符类型数据前、后有空格)
      

  2.   

    -- 还有:要注意 and .. or 等条件的逻辑关系!
      

  3.   


    select o.clientId from t_order o where o.clientId=c.id and o.supplierId=sup.id and o.sellorId=s.id ) 
    and (c.name='某某某……
    你没写FROM ****
      

  4.   

    你把WHEE的条件一个个去掉,再一个个加上,就能看出是哪的问题了。
      

  5.   

    估计是字符集设置的问题,按下帖中方法检查。http://blog.csdn.net/ACMAIN_CHM/archive/2009/05/12/4174186.aspx
    MySQL 中文显示乱码