2013-03-11 51 views
-1

我的條件我的查詢,我想創建這樣的我應該使用什麼查詢?

ID Name Address ID Name Address 
1 Dono x1 1 Dono x1 
2 Kasino x2 2 Kasino x2 
3 Indro x3 3 Indro x3 
4 Nano x4 4 Nano x4 

的數據來自一個表同一選擇查詢的查詢結果,但是當我使用它Union All沒有給我結果像我想要

這裏是我的查詢

select * from table x union all select * from table x

我應該用什麼樣的select說法?

+0

你爲什麼要重複相同的場兩次行? – 2013-03-11 10:29:33

+0

爲什麼你需要重複的字段? – Kaf 2013-03-11 10:34:37

+0

你爲什麼複製列? 任何具體原因.. – Aspirant 2013-03-11 10:56:48

回答

1
select ID, Name, Address, ID, Name, Address from table x; 
1

你需要的是

select id, name, address, id, name, address from x 
1
SELECT *, * FROM x 

這似乎很奇怪,但很有效。更奇怪的是,你需要這樣的結果。

UNION ALL用來連接從不同的查詢,而不是列。

1

你需要的是查詢...

select ID, [Name], [Address], ID, [Name], [Address] from Your_Tab