1
有2個數據庫表,如下所示Table_1 & Table_2。 Table_1列索引與table_2的id值匹配。 Table_2的名稱值將作爲查詢結果的列標題。將SQL表頭值與另一個表列值匹配
Table_1
______________________________________________
| date |city_1 | city_2 | ... | city_100 |
|-----------|-------|-------------------------|
| 20.02.2013| 4 | 34 | ... | 222 |
| 21.02.2013| 3 | 10 | ... | 33 |
| ... | ... | ... | ... | ... |
|_____________________________________________|
Table_2
___________________
| id | name |
|-------|---------|
| 1 | newyork |
| 2 | london |
| ... | ... |
| 100 | istanbul|
|_________________|
預期結果低於
__________________________________________________________
| date | newyork | london | ... | istanbul |
|-----------|------------|------------|-------|-----------|
| 20.02.2013| 4 | 34 | ... | 222 |
| 21.02.2013| 3 | 10 | ... | 33 |
| ... | ... | ... | ... | ... |
|___________|____________|____________|_______|___________|
什麼是SQL查詢來獲取引起上面?
感謝