CodeIgniter Forums
Active Record - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Active Record (/thread-2714.html)

Active Record - El Forum - 08-20-2007

Hello i was playing around with active record, and just got stuck with a select statement of

SELECT *,count(id),(SELECT MAX(id) FROM channelpollvote WHERE channelpollid=2)  FROM channelpollvote WHERE channelpollid=2 GROUP BY vote;

And i cannot think of how i could implement this :\

Does anyone know using the way of


Active Record - El Forum - 08-21-2007

May be better to use another method
$this->db->query('YOUR QUERY HERE');
Because this are too complex query (there have one sub query!).

Check CI manual for active record (, but i don't thinks this is passable !

PS. Sorry ,but English not my natural language

Active Record - El Forum - 08-21-2007

Yes i know i can do a query like that, but the reason i didnt want to is, because in the future i may change databases from mysql to say pgsql and that may not support that exact query syntax.

Active Record - El Forum - 08-21-2007

[eluser]Michael Wales[/eluser]
I don't think CI's current implementation of Active Record can support that query. As the previous posted said, it's quite complex.

Active Record is great for the simple, every day, queries - but when you get into things like this - it's not always the best choice (or even a possible choice).