Level 16
I think usually the joins are faster than subqueries
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Ok here's the thing both are working just want to know which is more ideal on Query Buillder Doing a subquery or Joining the table?
DB::raw('(SELECT Name FROM client_types WHERE client_types.id = taxonomy.Type ) AS Type'),
DB::raw('(CASE WHEN taxonomy.isVerified = "0" THEN "UNVERIFIED"
WHEN taxonomy.isVerified = "1" THEN "VERIFIED"
ELSE "UNVERIFIED"
END) AS Verification'))
->leftJoin('taxonomies as taxonomy', 'taxonomy_pivot.TaxonomyId','=','taxonomy.TaxonomyId');```
also what are the pointers to consider when to Join a table or create a subquery
Please or to participate in this conversation.