Re: Need help with SQL

From: AMARENDRA B NETTEM <nettama_at_charlie.cns.iit.edu>
Date: 1996/11/10
Message-ID: <32859E72.54FA_at_charlie.cns.iit.edu>#1/1


atyagi_at_mc.xerox.com wrote:
>
> Hi folks,
>
> Thanks to all who helped me last time. I have another question for
> you. I have written a query using UNION operator. I have tested these two
> queries seprately and they work well, but when I use the UNION an error
> appears telling me that UNION is an unknown command.. strange!
>
> here is my query :
>
> SELECT input_date, SUM(totbo) as USCO_TOTBO, SUM (xci_count) as XCI_TOTBO
> FROM
> (SELECT input_date, totbo, 0 as xci_count
> FROM uscobosum
> WHERE input_date >= ADD_MONTHS(sysdate,-24) and (TO_CHAR(input_date,'DAY') like 'M%')
>
> UNION
>
> SELECT input_date,0 as totbo, sum(totbo)
> FROM xci_bo
> WHERE input_date >=ADD_MONTHS(sysdate,-24)
> GROUP BY input_date
> )
> GROUP BY input_date;
>
> I will appreciate any help:
>
> Please post or mail to
>
> atyagi_at_mc.xerox.com
In your first statement (before UNION) you are missing the FROM caluse. for the main query  

-- 
    AMARENDRA B NETTEM
    ORACLE CONSULTANT
    WHITTMAN-HART CORPORATION, CHICAGO
    (http://www.iit.edu/~nettama)
Received on Sun Nov 10 1996 - 00:00:00 CET

Original text of this message