Re: Union query dropping "duplicate" rows
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 02/28/04
- Next message: Ray Higdon: "Re: Union query dropping "duplicate" rows"
- Previous message: Don Jellie: "Union query dropping "duplicate" rows"
- In reply to: Don Jellie: "Union query dropping "duplicate" rows"
- Next in thread: Vishal Parkar: "Re: Union query dropping "duplicate" rows"
- Reply: Vishal Parkar: "Re: Union query dropping "duplicate" rows"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 28 Feb 2004 23:57:01 +0530
hi don,
This is expected behavior of UNION clause. The answer for your problem will be to use UNIAON
ALL instead on UNION.Difference between UNION and "UNION ALL" clause is former will skip the
duplicate rows whereas later will join the result set of two queries as it is.
Try:
SELECT
CLASS, ITEM, SUM(COUNT)
FROM
CURRENT_TBL
GROUP BY
CLASS, ITEM
UNION ALL
SELECT
CLASS, ITEM, SUM(COUNT)
FROM
HISTORY_TBL
GROUP BY
CLASS, ITEM
Orde by 1, 2
-- Vishal Parkar vgparkar@yahoo.co.in
- Next message: Ray Higdon: "Re: Union query dropping "duplicate" rows"
- Previous message: Don Jellie: "Union query dropping "duplicate" rows"
- In reply to: Don Jellie: "Union query dropping "duplicate" rows"
- Next in thread: Vishal Parkar: "Re: Union query dropping "duplicate" rows"
- Reply: Vishal Parkar: "Re: Union query dropping "duplicate" rows"
- Messages sorted by: [ date ] [ thread ]