一个表a【username】一个表b【username,company,product】我想同时查找a,b这两个表让a的username等于b的usernameselect *
from a,b
where a.username= b.username这样的结果,会有很多重复的company请教如果同时保证company不重复呢???

解决方案 »

  1.   

    贴建表及插入记录的SQL,及要求结果出来看看select DISTINCT company
    from a,b
    where a.username= b.username
      

  2.   

    我想要全部的字段,同时company不重复
      

  3.   

    select distinct company
    from a,b
    where a.username= b.username
      

  4.   


    贴建表及插入记录的SQL,及要求结果出来看看
      

  5.   

    SELECT * 
    FROM b
    LEFT JOIN a AS a ON a.username=b.username
    WHERE a.username=b.username
      

  6.   

    select distinct company
    from a,b
    where a.username= b.username