Reputation: 1357
From this table:
DECLARE @tmp TABLE (id int, ahccs int, info varchar(25), endDate date)
5 123 et 2012-09-15
2 321 et 2012-04-27
2 321 et 2012-04-27
2 321 et 2012-04-27
3 134 et 2012-04-27
How could I insert only these values to another table
5 123 et 2012-09-15
2 321 et 2012-04-27
3 134 et 2012-04-27
Thanks!
Upvotes: 1
Views: 98
Reputation:
Using the Distinct Keyword:
Create table TableName AS (Select Distinct [id] as id, [ahccs] as ahccs, [info] as info, [endDate] as endDate From Table_Name)
Upvotes: 3