Subject | Re: [IBO] UNION |
---|---|
Author | Helen Borrie |
Post date | 2001-02-21T01:58:35Z |
It's a run-time computed column so you need to give it a column name, i.e.
SELECT 'TOTAL' as ColText, SUM(SINID),SUM(SINIC),SUM(RD),SUM(RC),SUM(SFIND),SUM(SFINC),
SUM(ZD),SUM(ZC) FROM BALANTA_CRT
Would be please be so kind as to post your SQL problems to the ib-support list? This list is for IB Objects. Thanks.
Cheers,
Helen
At 03:37 AM 21-02-01 +0200, you wrote:
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
SELECT 'TOTAL' as ColText, SUM(SINID),SUM(SINIC),SUM(RD),SUM(RC),SUM(SFIND),SUM(SFINC),
SUM(ZD),SUM(ZC) FROM BALANTA_CRT
Would be please be so kind as to post your SQL problems to the ib-support list? This list is for IB Objects. Thanks.
Cheers,
Helen
At 03:37 AM 21-02-01 +0200, you wrote:
>I need to make a report based on two viewsAll for Open and Open for All
>
> select * from BALANTA_SINT_CRT
> union all
> select * from TOT_BALANTA_CRT
>
>
>CREATE TABLE "BALANTA"
>(
> "DATA" DATE NOT NULL,
> "CONT" VARCHAR(18) NOT NULL,
> "FCT" VARCHAR(1) NOT NULL,
> "SINTETIC" VARCHAR(7),
> "SINID" NUMERIC(18, 2) DEFAULT 0,
> "SINIC" NUMERIC(18, 2) DEFAULT 0,
> "RD" NUMERIC(18, 2) DEFAULT 0,
> "RC" NUMERIC(18, 2) DEFAULT 0,
> "SFIND" NUMERIC(18, 2) DEFAULT 0,
> "SFINC" NUMERIC(18, 2) DEFAULT 0,
> PRIMARY KEY ("DATA", "CONT"))
>
>CREATE TABLE "RULAJE"
>( "DATA" DATE NOT NULL,
> "CONT" VARCHAR(18) NOT NULL,
> "SINTETIC" VARCHAR(8),
> "DEBIT" NUMERIC(18, 2) DEFAULT 0,
> "CREDIT" NUMERIC(18, 2) DEFAULT 0,
> PRIMARY KEY ("DATA", "CONT"))
>
>CREATE VIEW "BALANTA_CRT" (
> "DATA", "CONT", "FCT", "SINTETIC", "SINID", "SINIC", "RD",
>"RC", "SFIND", "SFINC", "ZD", "ZC"
>) AS
>SELECT
>B.DATA,B.CONT,B.FCT,B.SINTETIC,B.SINID,B.SINIC,B.RD,B.RC,B.SFIND,B.SFINC,
> R.DEBIT,R.CREDIT FROM BALANTA B
>LEFT JOIN RULAJE R ON B.DATA=R.DATA AND B.CONT=R.CONT
>WHERE B.DATA=(SELECT DATALUCRU FROM CONFIG)
>
>
>CREATE VIEW "BALANTA_SINT_CRT" (
> "SINTETIC", "SINID", "SINIC", "RD", "RC", "SFIND", "SFINC",
>"ZD", "ZC"
>) AS
>SELECT SINTETIC,SUM(SINID),SUM(SINIC),SUM(RD),SUM(RC),SUM(SFIND),SUM(SFINC),
>SUM(ZD),SUM(ZC) FROM BALANTA_CRT
>GROUP BY SINTETIC
>
>
>CREATE VIEW "TOT_BALANTA_CRT" (
> "SINTETIC", "SINID", "SINIC", "RD", "RC", "SFIND", "SFINC",
>"ZD", "ZC"
>) AS
>SELECT 'TOTAL', SUM(SINID),SUM(SINIC),SUM(RD),SUM(RC),SUM(SFIND),SUM(SFINC),
>SUM(ZD),SUM(ZC) FROM BALANTA_CRT
>
>When I try to execute the union statement I get:
>
>Dynamic SQL Error
>SQL error code = -104
>Invalid command
>Data type unknown
>
>If I make the statement like
>
>select "SINID", "SINIC", "RD", "RC", "SFIND", "SFINC", "ZD",
>"ZC"
>from BALANTA_SINT_CRT
>union all
>select "SINID", "SINIC", "RD", "RC", "SFIND", "SFINC", "ZD",
>"ZC"
> from TOT_BALANTA_CRT
>
>works fine.
>
>But I need the first column too !
>
>Any help please ?
>
>D5 / IB 6.0.1 / 3.6 Cf
>
>TIA
>Dorin
>
>
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________