select distinct * from materielhead

解决方案 »

  1.   

    上面的写法不对呀!这样会把:
    c   222        ggg
    d   333        yyy
    显示出来!
    不过还是要谢谢你!
      

  2.   

    select distinct * from materielhead where fg in
    (select fg from materielhead group by fg,mreccode where having count(*)>1)
      

  3.   

    select distinct * from materielhead where fg not in(select fg from materielhead group by fg having count(*)=1)
      

  4.   

    select A.* from materielhead A inner join materielhead B on A.fg=B.fg and A.mreccode=B.  mreccode and A.department=B.department
      

  5.   

    select A.* from materielhead A 
    inner join materielhead B 
    on A.fg = B.fg and 
       A.mreccode = B.mreccode and 
       A.department <> B.department
      

  6.   

    请问楼主,fg是a的话,mreccode一定是"123"吗?会否存在fg=a,mreccode=111的情况?