从此表中:
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
我怎么能只将这些值插入另一个表
5 123 et 2012-09-15
2 321 et 2012-04-27
3 134 et 2012-04-27
谢谢!
答案 0 :(得分:3)
使用区别关键字:
Create table TableName AS (Select Distinct [id] as id, [ahccs] as ahccs, [info] as info, [endDate] as endDate From Table_Name)