0

我有一个表使用查询我们如何从第一个表值中实现第二个表结构

4

3 回答 3

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'
于 2013-03-11T09:02:04.660 回答
0

SELECT * INTO tblNew FROM oldTbl

如果您只想复制结构:

SELECT * INTO tblNew FROM oldTbl WHERE 1=2
于 2013-03-11T06:12:33.117 回答
0

如果你想克隆一个表

Select * into Dest_Table from Src_Table

如果你想复制

insert * into Dest_Table select * from Src_Table
于 2013-03-11T06:15:27.657 回答