select 产品编号,min(日期) 日期,结存数 from table 
group by 产品编号

解决方案 »

  1.   

    Select a.日期,a.产品编号,a.结存数
        from  yourTable a join (Select 产品编号,max(日期) as 日期 from yourTable group by 产品编号) b 
        on a.日期 = b.日期 and a.产品编号 = b.产品编号
      

  2.   

    写错了
    select a.日期,a.产品编号,a.结存数 from table1 a,(select 产品编号,min(日期) 日期from table1 
    group by 产品编号
    ) b
    where a.产品编号=b.产品编号 and a.日期=b.日期
      

  3.   

    写错了
    select a.日期,a.产品编号,a.结存数 from table1 a,(select 产品编号,max(日期) 日期from table1 
    group by 产品编号
    ) b
    where a.产品编号=b.产品编号 and a.日期=b.日期
      

  4.   

    select top 6 * from tableName order by 日期 desc