![]() |
Mutiple SQL count() from several tables - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Mutiple SQL count() from several tables (/showthread.php?tid=5913) Pages:
1
2
|
Mutiple SQL count() from several tables - El Forum - 03-25-2008 [eluser]oliviermarian[/eluser] Thxs. actually i did some tests and when an error occurs it returns the sql generated so I think I managed to do What i wanted. may be useless out of context but here is my final code, in case it brings light to someone else: OPTION ACTIVE RECORD: Code: $this->db->select(" count(*) AS how_many_comments, which does the same job as Code: $sql_right_column = " For such queries, what is the best practice : use Active Record ? Why ? Thanks for your advices. Olivier. Mutiple SQL count() from several tables - El Forum - 03-25-2008 [eluser]GSV Sleeper Service[/eluser] you can use count(1) instead of count(*) for a slight perfomance boost. it's probably worthwhile sticking EXPLAIN in front of your query to see where the bottleneck is. |