求助一条Sql语句的怎么写
我现在要查询 同一个refno 最后一个评审人的名字(最大的日期,同一个refno,姓名)
请问现在我该怎么写这个语句。
[解决办法]
select * from tb a
where a.reviewdate=(select max(reviewdate) from tb where refno=a.refno)
SELECT * FROM TB a WHERE reviewdate=(SELECT MAX(reviewdate) FROM TB WHERE refno=a.refno)
select * from tb as a
where not exists(select 1 from tb as x where x.refno=a.refno and x.reviewdate>a.reviewdate)
select * from [Table] T where T.reviewdate =
(select max(reviewdate) from [Table] where refno = T.refno)