Programming in mysql: MySQL UNION – combining the returned values into one set of rows on newest questions tagged mysql – Stack Overflow
I am new to MySQL and need to ask for your help please.
I am selecting 2 sets of count values from the same table in 2 parts of a union using different WHERE clause values to differentiate; like this:
SELECT Count(column1) as 'RED', null as 'BLUE' FROM TableA Where column1 Like 'RED' UNION SELECT NULL, Count(column1) FROM TableA Where column1 Like 'BLUE'
I was hoping to get:
RED BLUE --- ---- 23 55
But what I actually get is:
RED BLUE --- ---- 23 NULL NULL 55
Can anyone please tell me what I’ve done wrong and how I can get my desired answer please?
Thanks for your help…
Programming in mysql: programming-in-mysql