insert into MetricPoints (MeterID,MetricPointName,[Description],DepartmentID,MediumID)
(SELECT m.MeterID,m.MetricItems+m.InstallPlace as m_MetricPointName,m.MetricItems,m.DepartmentID,m.MediumID
FROM Meters m WHERE NOT EXISTS (SELECT 1 FROM MetricPoints WHERE MetricPoints.MeterID = m.MeterID ) and m.MediumID =2)
声名:a,b ,都是表
insert into b select * from a
若两表只是有部分(字段)相同,则
insert into b(col1,col2,col3,col4,...) select col1,col2,col3,col4,... from a where...
把表a插入到表b中去。
select * into b from a
//
select (字段1,字段2,...) into b from a