SqlServer查询表中某列相同值的最近记录
程序员文章站
2022-06-01 19:47:09
...
语句如下:
1 --查询表中某列相同值的最近记录
2 SELECT * FROM TbName a
3 WHERE NOT EXISTS
4 (
5 SELECT 1 FROM TbName WHERE ColumnName=a.ColumnName and CreateTime>a.CreateTime
6 )