|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 12:28 PM
Points: 76,
Visits: 304
|
|
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.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:43 AM
Points: 38,112,
Visits: 30,399
|
|
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 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 12:28 PM
Points: 76,
Visits: 304
|
|
| The columns in the table a ,b ,c are already using aggregate functions like max(duration) ,min(perf),avg(proc)
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 12:28 PM
Points: 76,
Visits: 304
|
|
|
|
|