Re: Sum a Union Query

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 10/24/04

  • Next message: news.microsoft.com: "Re: Sum a Union Query"
    Date: Sun, 24 Oct 2004 22:27:28 +0200
    
    

    On Sun, 24 Oct 2004 16:37:14 +0100, Newbie wrote:

    >What I want to know is how to do the sum part on a union query?

    Hi,

    The genral format is something like this:

    SELECT xxx, yyy, SUM(zzz), SUM(qqq)
    FROM (SELECT xxx, yyy, zzz, qqq
             FROM ....
             WHERE ....
             UNION [ALL]
             SELECT xxx, yyy, zzz, qqq
             FROM ....
             WHERE ....) AS d(xxx, yyy, zzz, qqq)
    GROUP BY xxx, yyy

    If you need more specific help, re-read my previous message indicating
    what information you should post to enable me to help you.

    Best, Hugo

    -- 
    (Remove _NO_ and _SPAM_ to get my e-mail address)
    

  • Next message: news.microsoft.com: "Re: Sum a Union Query"