select * from table1 where id in ('001','004')

解决方案 »

  1.   

    select * from table1 aa where ITM=(select min( ITM) from table1 where g=aa.g)
      

  2.   

    select * from table1 where id in(select min(id) as id from table1 group by g)
      

  3.   

    select * from table1 aa where id=(select top 1 id from table1 where g=aa.g)
    select * from table1 aa where id=(select min(id) from table1 where g=aa.g)
      

  4.   

    select a.*
    from table1 a join
         (  select min(id) as mi,g
            from table1
            group by g
         ) b 
         on a.id=b.mi
      

  5.   

    比如说:
    表结构为:
       ID  ID1  ID2  ITM   QTY  G
      001  A0   B1    1    2    1
      001  A0   B1    2    4    1
      002  A1   B1    3    6    1
      003  A0   B1    1    1    2
      004  A1   B1    2    4    2
    我想得到:
       ID  ID1  ID2  ITM   QTY  G
       001  A0   B1   1    2    1
       003  A0   B1    1    1   2
      

  6.   

    還是
    select * from table1 where id in ('001','003')
      

  7.   

    pengdali(大力 V3.0) 是对的
      

  8.   

    现在问题已经很简单了,你在表中建一个主键(自动加1),然后安pengdali(大力 V3.0) 的方法实现就搞定了
      

  9.   

    再增加一个字段(自动加1),你什么都不需要管呀,insert、update都不用你管,会有什么问题?