Reputation: 90
I am confused on how to query multiple tables at once and how to combine them. What is the proper why to combine multiple SELECT queries in it's simplest form?
$id = 2;
$result = conn()->query("
SELECT * FROM members WHERE id='$id'
UNION
SELECT * FROM users_meta WHERE id='$id'
");
Edit 3-5-2016
Speed tips for reading lots of data for MySqli.
Upvotes: 0
Views: 74
Reputation: 6661
Try join
SELECT * FROM members m join users_meta u
on m.id=u.id
WHERE m.id='$id'
Upvotes: 1