📜  如何在 mssql 服务器中显示从日期到最新的用户 ID - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:31.939000             🧑  作者: Mango

代码示例1
-- [=====[ Option 1 ]=====]
SELECT    TOP 1 
        TransID, [Date] 
FROM    #RNT1 
ORDER BY [Date] DESC, 
         TransID DESC

-- [=====[ Option 2 ]=====]
SELECT TOP 1 
       TransID, [Date]
FROM   #RNT1
WHERE  [Date]= (SELECT Max([Date]) FROM #RNT1)
ORDER BY TransID DESC