List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:March 8 2002 12:34am
Subject:Re: Bug or Misunderstanding
View as plain text  
At 17:42 -0500 3/7/02, mike.miller@stripped wrote:
>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 =
>SELECT column_id, SUM(column_a) AS negative_a FROM table_a WHERE columb_b =
>I would expect to receive three columns back (column_id, positive_a,

Why do you expect three?

>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

Sounds like maybe you want some kind of join rather than a UNION?

>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: mike.miller@stripped

Bug or Misunderstandingmike.miller7 Mar
Re: Bug or MisunderstandingPaul DuBois8 Mar