1
我需要显示两个表的内容;我的查询是这样的:添加列的结果另一列
SELECT ID,
post_author,
post_content,
post_title,
post_name,
guid,
post_type,
meta_id,
post_id,
meta_key,
meta_value
FROM wp_posts,
wp_postmeta
WHERE wp_posts.ID = wp_postmeta.post_id
AND post_author IN (2);
的meta_key列存储的内容的类型,我需要一个像网站,纬度,经度,电话,电子邮件。有没有办法让这个列爆炸到另一列?例如:
ID,
post_author,
...,
meta_id,
post_id,
meta_key,
meta_value,
website(its a meta_key result),
latitude(another meta_key result),
longitude(anoter meta_key result)...
看看这个截图,在那里你可以看到geo_latitude和geo_longitude作为meta_key的结果,我想让它显示在另一列......这可能吗? http://img856.imageshack.us/img856/4562/query.jpg – 2013-04-04 19:21:58
@JefersonSantos - 是的,这是我的查询做什么。你试过了吗? – 2013-04-04 19:25:55
喔我忘了告诉,在meta_value有相关meta_key值,所以我whant做出geo_latitude柱从截图中meta_value行的数据,但在分隔的列,如: | ID | post_author | ... | geo_latitude | geo_longitude | ... | 5281 | 3 | ... | -56.0 ....... | 15.62 ........ | ... 屏幕上的查询是我的第一篇查询。 其中wp_posts.ID = wp_postmeta.post_id和post_author在(3) – 2013-04-04 19:36:31