Welcome Guest, Not a member yet? Register   Sign In
Can't perform a UNION ALL MySQL query
#8

[eluser]Ci beginner[/eluser]
[quote author="kgill" date="1248733521"]
Quote:Actually I don’t know how to make it with separate queries
You're overthinking this:
Code:
$this->db->select(first query here);
$something = $this->db->get();

// repeat for each of the other queries
$this->db->select(2nd query here);
$something_else = $this->db->get();

// etc.
[/quote]

I can't do it... imagine this situation: we have a blog, with a query that gets the latest 5 posts. Now, we need to count the comments for every post, to write near the title "X comments". And the only way to do it is with UNION ("blog" for posts and "comentarios_blog" for comments), not with two queries, I think. But I'm unable to perform UNION thing because I don't know how to do in CI...

Thanks!


Messages In This Thread
Can't perform a UNION ALL MySQL query - by El Forum - 07-26-2009, 09:25 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-26-2009, 09:43 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-26-2009, 09:55 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 08:58 AM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 10:35 AM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 11:18 AM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 11:25 AM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 12:15 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 12:55 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 01:05 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 02:24 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 07:01 PM
Can't perform a UNION ALL MySQL query - by El Forum - 07-27-2009, 07:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB