CodeIgniter Forums
SubQuery - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: SubQuery (/showthread.php?tid=86104)



SubQuery - motoroller - 01-10-2023

How do this:

$query = $this->db->table('catalog as C')->select(*)
->select('(SELECT `title` FROM `help_catalogs` WHERE `id` = c.parent) AS SubCatalogTitle')


RE: SubQuery - michalsn - 01-10-2023

This is how you can handle subqueries: https://www.codeigniter.com/user_guide/database/query_builder.html#subqueries


RE: SubQuery - motoroller - 01-10-2023

(01-10-2023, 11:50 AM)michalsn Wrote: This is how you can handle subqueries: https://www.codeigniter.com/user_guide/database/query_builder.html#subqueries

I have variable in subquery which in main query