我需要創建一個SQL視圖(使用MySQL Workbench),該視圖應該只取一行的所有值,並將它們與第一列上各自的列名稱堆疊在一起。就像這樣:如何創建2列SQL視圖?
原始表:
name | email | address | country | ...
------------------|----------------------|--------------------|------------|
Al Wade Avery | [email protected] | 1004 Court Street | USA |
Antone Clay | [email protected] | 6219 Devon Court | UK |
Issac Luigi | [email protected] | 43 Bridge Street | USA |
Lucio Andrea | [email protected] | 2283 Laurel Lane | Italy |
... | ... | ... | ... |
查看:
field | value |
--------------|-------------------|
name | Al Wade Avery |
email | [email protected] |
address | 1004 Court Street |
country | USA |
... | ... |
name | Antone Clay |
email | [email protected] |
address | 6219 Devon Court |
country | UK |
... | ... |
name | Issac Luigi |
email | [email protected] |
address | 43 Bridge Street |
country | USA |
... | ... |
你不想這樣做。你沒有將相似結果組合在一起的「id」。 –