I’m trying to get a unique list of a table with two columns …
Table snapshot:
ITEM DISP
-----------------
903996 , 1600
903996 , 3D13
123045 , 1D23
450300 , 3D14
450300 , 3DAD
The output I need is the following
ITEM DISP
-----------------
903996 , 1600
123045 , 1D23
450300 , 3D14
I know that in SQL Server 2005 the ROW_NUMBER is very helpful for this type of problem by I’m working in SQL Server 2000 and this function does not exist.
This is my idea for SQL Server 2005:
Select [ITEM],[DISP]
FROM (
SELECT
[ITEM]
,[DISP]
,ROW_NUMBER() OVER (PARTITION BY [ITEM] ORDER BY [ITEM]) as RowNumber
FROM [TABLE]
) WHERE RowNumber =1
How can I do this in SQL Server 2000?
Thanks
You should be able to use
MIN()withGROUP BY:See SQL fiddle with Demo
Result: