select top 1 from table1 where 编号 =@num order by 时间

解决方案 »

  1.   

    时间=最新
    _________________
    max(yourdate)只返回一条记录
    _________________
    top 1
      

  2.   

    select top 1 from table where 编号=@num order by 时间Desc
      

  3.   

    Select * from table1 where 编号=@num and 时间=Date() top 1
    根据数据库的不同,可能是getdate()函数。
      

  4.   

    写错,更正一下:
    Select top 1 from table1 where 编号=@num and 时间=Date() order by 时间
      

  5.   

    SELECT TOP 1 *
    FROM HistStatus
    WHERE (锭位号 = 12)
    ORDER BY 开始时间 DESC第一行后面还要加个 * , 不然说“请选择列”
      

  6.   

    sql 不熟悉,见笑了。多谢各位
      

  7.   

    用select top 1 from table where 编号=@num order by 时间Desc
    或select max(时间) from table where 编号=@num group by ...