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

[eluser]Ci beginner[/eluser]
[quote author="kgill" date="1248730530"]Your SQL is the problem, read up on UNION ALL - you can't have mismatched columns, your 1st select is returning 2 columns, the 2nd is returning however many are in the blog table and the last select is returning 1. These are separate queries - why are you trying to combine them? It can be done if you ensure that each query has the same number of columns and returns the same types for each column, but any speed gains you get from making 1 trip from the web server to the DB are going to be lost in the amount of code you'll have to write to sort out what goes where when you get the result back.[/quote]

Hey, thanks for your help. Actually I don't know how to make it with separate queries because I always have done this with UNION, but not in CI. I understand your explanation -- and I'm very grateful about it. However, if you can provide a working example for the UNION or without UNION (you know, separate queries) I'll understand how it works.

Thank you again!


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