I have following SQL statementL:
select DATE(bla), count(*) from tableA group by DATE(bla)
UNION ALL
select DATE(bla), count(*) from tableB group by DATE(bla)
order by "DATE(bla)"
What I get from the first part of the query:
(2012-05-07, 13)
And from the second part:
(2012-05-07, 15)
What I would expect to see after executing the whole query:
[(2012-05-07, 13),
(2012-05-07, 15)]
What I really get:
[(2012-05-07, 13)]
The question is why and what should I change to get what I expect?
OK, I solved the problem. You were right, the problem has something to do with the data. In the real case I had many rows but thought ‘order by DATE(bla)’ part of the query will sort them by date. This is not true, and this will be ignored until I add alias for the date field. And that’s why I was so confused. Sorry for that, and thanks for your help.