2014-04-18 57 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

相关问题