I have table which contains data as below:
DECLARE @CheckList TABLE
(
RowNumber INT IDENTITY(1,1) INT,
CheckId INT,
Treat INT
)
INSERT INTO @CheckList
VALUES (1, 1, 1), (1, 3, 1), (1, 2, 1), (1, 1, 1),
(1, 3, 1), (1, 2, 1), (1, 1, 3), (1, 3, 3),
(1, 2, 3);
SELECT DISTINCT Id, CheckId
FROM @CheckList
WHERE Id = 1
Where I want to select the data from this table as
Id CheckId
------------
1 1
1 3
1 2
I want the same order of the check id which is available in table. Can you help me with this?
(1,1,1)? or it is(1,1,2)?idcolumn? How you are inserting data inidentitycolumn?