修改。我的 SQL 有限,非常感谢您的帮助。在一次点击中,我想通过 ID ($ga_id) 查询两个表,每个表都有一个内部连接到另一个表(表具有完全相同的列,并且父表彼此没有关系)。
我可以成功查询net_5_postmeta表如下
SELECT p.*
FROM net_5_postmeta AS pm
INNER JOIN net_5_posts AS p ON pm.meta_value=p.ID
WHERE pm.post_id = $ga_id
AND pm.meta_key = '_thumbnail_id'
ORDER BY p.post_date DESC
LIMIT 4
但我想查询 net_5_postmeta 表和 net_7_postmeta 表(它们具有相同的列),我认为它需要类似于...
SELECT p.*
FROM net_5_postmeta, net_7_postmeta AS pm
INNER JOIN net_5_posts AS p ON pm.meta_value=p.ID
INNER JOIN net_7_posts AS p ON pm.meta_value=p.ID
WHERE pm.post_id = $ga_id
AND pm.meta_key = '_thumbnail_id'
ORDER BY p.post_date DESC
LIMIT 4