Revised. My SQL is limited, so really appreciate your help. In one hit, I want to query by ID ($ga_id) two tables each with an inner join to another table (tables have exactly the same columns and the parent tables have no relationship to each other).
I can successfully query the net_5_postmeta table as follows
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
but I want to query the net_5_postmeta table and the net_7_postmeta table (they have the same columns), I think it needs to be something along the lines of…
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
As you say that parent tables have no relationship i can only assume that you want to treat 5 and 7 tables as if they were the same. You should use
union allto bring their data together and then do ORDER BY/LIMIT.