答案 0 :(得分:0)
您可以使用相关子查询
select * from tablename a where lasttime in (select max(lasttime) from tablename b where a.id=b.id)
或者您可以使用row_number()
select * from
(
select *,row_number() over(partition by id order by lasttime desc) as rn from tablename
)A where rn=1
答案 1 :(得分:0)
只需在字段前面添加前1名。
Select TOP 1 fields from table
答案 2 :(得分:0)
SELECT TOP 1 currentBalance FROM DBO.tbl_billing ORDER BY [date]