0

所以目前我在两个 mysql tabales 之间有关系: wp_bp_activity与“id”和“content”和 wp_bp_activity_meta与“activity_id”这将匹配 wp_bp_activity id 和“meta_value”我试图根据 wp_bp_activity_meta -> meta_value 的文本输出wp_bp_activity -> content where wp_bp_activity -> id = wp_bp_activity_meta -> activity_id 甚至不确定这样的事情是否可行。我被困住了!这是我到目前为止的代码:

$query = "SELECT * FROM wp_bp_activity_meta WHERE meta_value LIKE 'test'";

4

2 回答 2

0
SELECT  a.*, b.*
FROM    wp_bp_activity a
        INNER JOIN wp_bp_activity_meta b
            ON CONCAT(a.id, a.meta_value) = b.activity_id
于 2012-12-13T02:47:45.000 回答
0
$query = "SELECT *
FROM wp_bp_activity_meta
INNER JOIN wp_bp_activity
ON wp_bp_activity.if = wp_bp_activity_meta.activity_id
WHERE meta_value LIKE 'test' ";
于 2012-12-13T02:48:31.867 回答