Is this not the definition of a union?

Max

In Interbase the group by applies to the individual select, not the union
result.

I just tried this

select subdepartmentcode, count(*) from product where plu between 1 and 200
group by subdepartmentcode
union
select subdepartmentcode, count(*) from product where plu between 201 and
400
group by subdepartmentcode

and got

SUBDEPARTMENTCODE       COUNT
================= ===========

202                         1
202                         2
203                         1
203                         4
204                         2
205                         1
205                         2
...


>From: "Darren J Gilbertson" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: Multiple recipients of list database <[EMAIL PROTECTED]>
>Subject: [DUG-DB]:  SQL Problem
>Date: Mon, 9 Aug 1999 11:48:48 +1200
>
>I would like to create a query using both UNION and GROUP BY.
>
>I plan to combine to tables, then perform a group by on the combination.
>How
>do I do this?
>
>I have only managed to do a group by on the individual tables then combine
>them, but I want to combine the tables first then do a group by.
>
>Can somebody please help me.
>
>
>Darren Gilbertson
>[EMAIL PROTECTED]
>
>--------------------------------------------------------------------------
-
>   New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to