1
我如何添加不同以下查詢:在SQL Server DISTINCT 2005查詢
SELECT TOP(30) X.ID ,ROW_NUMBER() OVER (ORDER BY Create DESC) AS LIMIT
FROM X INNER JOIN Y ON X.ID = Y.ID
因爲現在我得到了很多的多個記錄
我如何添加不同以下查詢:在SQL Server DISTINCT 2005查詢
SELECT TOP(30) X.ID ,ROW_NUMBER() OVER (ORDER BY Create DESC) AS LIMIT
FROM X INNER JOIN Y ON X.ID = Y.ID
因爲現在我得到了很多的多個記錄
嘗試是這樣的:
WITH CTE AS
(
SELECT DISTINCT TOP(30) X.ID, X.CREATE FROM X INNER JOIN Y ON X.ID = Y.ID
)
SELECT *, ROW_NUMBER() OVER (ORDER BY Create DESC) AS LIMIT
FROM CTE
您必須在查詢中插入CREATE