復(fù)制代碼 代碼如下:
---更新計(jì)量點(diǎn)中不存在的數(shù)據(jù),將臺(tái)帳中的信息轉(zhuǎn)移到計(jì)量點(diǎn)中
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)
復(fù)制代碼 代碼如下:
--b表存在(兩表結(jié)構(gòu)一樣)
insert into b select * from a
復(fù)制代碼 代碼如下:
insert into b(col1,col2,col3,col4,...) select col1,col2,col3,col4,... from a where...
復(fù)制代碼 代碼如下:
--b表不存在
select * into b from a
//
select (字段1,字段2,...) into b from a
新聞熱點(diǎn)
疑難解答
圖片精選