December 16, 2008 at 4:00 pm
Hi,
table A which has 4 records
union all
Table B -has 4 records --getting result set using 3 tables
union all
table c - has 4 records
..
when i use union all I'm getting 12 records altogether in a result set..
My question is i want to see the sum of all records so that i will get only 1 record in the result set.
December 16, 2008 at 4:03 pm
SELECT SUM(SomeColumn) FROM (
SELECT SomeColumn FROM TableA
UNION ALL
SELECT SomeColumn FROM TableB
UNION ALL
SELECT SomeColumn FROM TableC) sub
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 16, 2008 at 4:14 pm
The columns in the table a ,b ,c are already using aggregate functions like max(duration) ,min(perf),avg(proc)
December 16, 2008 at 4:23 pm
It worked .
Thanks Gil.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply