我在用
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (X64) Jul 9 2008 14:17:44 版权所有 (c) 1988-2008 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)
当我尝试按日期排序时,它没有给出正确的顺序
DECLARE @dd table (ID int,rate numeric(5,2), orderdate smalldatetime)
INSERT INTO @dd
SELECT 1,10,'2013-03-05 10:11:00'
UNION ALL
SELECT 2,25,'2013-03-05 10:11:00'
UNION ALL
SELECT 3,30,'2013-03-05 10:10:00'
UNION ALL
SELECT 4,50,'2013-03-05 10:11:00'
UNION ALL
SELECT 5,60,'2013-03-05 10:15:00'
SELECT top 2 * FROM @dd Order by orderdate desc
ID 1,2,4 具有相同的orderdate
值
它以 id 5 和 2 的顺序显示结果,这是不正确的。它实际上应该显示 orderid 5,4。