Perhaps I misunderstand how the UNION statement is to be used, but the
following query doesn't work as I'd expect:

SELECT column_id, SUM(column_a) AS positive_a FROM table_a WHERE column_b =
'positive'
UNION
SELECT column_id, SUM(column_a) AS negative_a FROM table_a WHERE columb_b =
'negative'

I would expect to receive three columns back (column_id, positive_a,
negative_a), but what I receive is two columns, with the duplicate
column_id's and the negative_a results being lumped under the positive_a
column.

Can anyone point me in the right direction on this?  This is MysQL 4.0.1
FreeBSD binary install.

--
Mike Miller, BMG Canada Inc.
Tel: 416-586-1646
Fax: 416-586-1661
EMail: [EMAIL PROTECTED]



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to