我有一个表使用查询如何从第一个表值
获得第二个表结构答案 0 :(得分:1)
SELECT t1.PageID,
t1.Value AS PC,
t2.Value AS OS,
t3.Value AS Hardware,
t4.Value AS Software
FROM srcTable t1
JOIN
srcTable t2 ON t1.PageID = t2.PageID
JOIN
srcTable t3 ON t1.PageID = t3.PageID
JOIN
srcTable t4 ON t1.PageID = t4.PageID
WHERE t1.Header = 'PC'
AND
t2.Header = 'OS'
AND
t3.Header ='Hardware'
AND
t4.Header = 'Software'
答案 1 :(得分:0)
SELECT * INTO tblNew FROM oldTbl
如果您只想复制结构:
SELECT * INTO tblNew FROM oldTbl WHERE 1=2
答案 2 :(得分:0)
如果你想克隆一张桌子
Select * into Dest_Table from Src_Table
如果你想复制
insert * into Dest_Table select * from Src_Table