I’ve got a query that’s rather inefficient, and I think that I can use SQL JOIN to cut it down.
Here are the two queries:
$data = $db->query("SELECT * from tbl_forums_threads WHERE tid = '$id'");
$threaddata = $data->fetch_assoc();
$dataset = $db->query("SELECT * from tbl_forums_posts WHERE tid = '$id'");
$thread = $dataset->fetch_assoc();
Obviously, they have 1 thing in common: the use of $id.
Could I use SQL JOIN, or even LEFT JOIN?
Thanks!
1 SQL query with a JOIN isn’t necessarily faster than a 2 simple query like that.
Stay with this imo.