这次有分了,大家帮我看下
我自建个视图
SELECT TOP 100 PERCENT *
FROM dbo.trade
WHERE (1 = 1) AND (id IN
(SELECT MAX(id) AS id
FROM trade
GROUP BY comid))
ORDER BY memberType DESC
但因为这段东西,ID号本身就不是按次序来的,有的是10在15后面这样。
那以我想为视图再建一个可以有序的ID怎么做
NEWID() AS AA
不行,那不是数字
------解决方案----------------------try
SELECT TOP 100 PERCENT ID=identity(int, 1, 1),* into #T
FROM dbo.trade
WHERE (1 = 1) AND (id IN
(SELECT MAX(id) AS id
FROM trade
GROUP BY comid))
ORDER BY memberType DESC
select * from #T