2014-04-18 103 views
-1

這是我的表結構MySQL的:獲取多行的不同的值,以一個單列

我的表名SITEINFO

id | key   | value 

1  | facebook | facebook.com 

2  | twitter  | twitter.com 

3  | googleplus | google.com 

4  | linkedin | linkedin.com 

在這裏,我如何從單一的SQL列

+0

你已經張貼在這裏同樣的問題: http://stackoverflow.com/questions/23149606/select-multiple-rows-different-value-from-same-table 我的方式回答說會工作。你爲什麼又問這個問題? – Helpful

+0

檢索兩行並連接它 –

回答

0
得到Facebook和GOOGLEPLUS值

我覺得這就是你要找的,

select group_concat(`value` separator ', ') url 
from siteinfo 
where `key` in ('facebook','googleplus'); 

這裏是,SQLFiddle

相關問題