> >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.
// If your DB supports Views that is...
Try creating a union view and then use group by on the view.
CREATE OR REPLACE VIEW TEST_VIEW AS
SELECT Value1,Value2 FROM Spam1
UNION
SELECT Value1,Value2 FROM Spam2;
SELECT Value1,count(Value2) FROM TEST_VIEW GROUP BY Value1;
or something like that
--
Aaron@home
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz