× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Okay, guys... this is interesting we are doing a very... um... interesting
SQL script. However it is now bombing out.

This works:
SELECT  CCC, FFF,

    (SELECT SUM( COALESCE( CUVROCNIE.BALANCE, 0 ) + COALESCE(
CUVROCNIBT.BALANCE, 0 ) ) AS FISCAL_YEAR_1
        FROM    LAWCUSTDBF.CUVROCNIBT CUVROCNIBT
                LEFT OUTER JOIN LAWCUSTDBF.CUVROCNIE CUVROCNIE ON
                CUVROCNIBT.COMPANY = CUVROCNIE.COMPANY AND
                CUVROCNIBT.FISCAL_YEAR = CUVROCNIE.FISCAL_YEAR AND
                CUVROCNIBT.PERIOD = CUVROCNIE.PERIOD
            WHERE   CUVROCNIBT.COMPANY = CCC AND
                    CAST( CONCAT( CONCAT( CONCAT( CAST(
CUVROCNIBT.FISCAL_YEAR AS CHARACTER(4)), '-' ), TRIM(
CAST(CUVROCNIBT.PERIODAS CHARACTER(2)) ) ), '-1' ) AS DATE ) + 11
MONTHS >= FFF AND
                    CAST( CONCAT( CONCAT( CONCAT( CAST(
CUVROCNIBT.FISCAL_YEAR AS CHARACTER(4)), '-' ), TRIM(
CAST(CUVROCNIBT.PERIODAS CHARACTER(2)) ) ), '-1' ) AS DATE ) <= FFF)
AS WHAT,

    (SELECT SUM(COALESCE(CUVROCTD.BALANCE,0) + COALESCE(CUVROCTDEB.BALANCE,0)
+ COALESCE(CUVROCTDTD.BALANCE,0) + COALESCE(CUVROCIB.BALANCE,0) + COALESCE(
CUVROCSE.BALANCE,0))/13 AS BALANCE
        FROM    LAWCUSTDBF.CUVROCSE CUVROCSE
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCIB CUVROCIB
            ON  CUVROCSE.COMPANY = CUVROCIB.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCIB.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCIB.PERIOD
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCTD CUVROCTD
            ON  CUVROCSE.COMPANY = CUVROCTD.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCTD.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCTD.PERIOD
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCTDEB CUVROCTDEB
            ON  CUVROCSE.COMPANY = CUVROCTDEB.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCTDEB.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCTDEB.PERIOD
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCTDTD CUVROCTDTD
            ON  CUVROCSE.COMPANY = CUVROCTDTD.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCTDTD.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCTDTD.PERIOD
            WHERE   CUVROCSE.COMPANY = CCC AND
                    CAST( CONCAT( CONCAT( CONCAT(
CAST(CUVROCSE.FISCAL_YEARAS CHARACTER(4)), '-' ), TRIM( CAST(
CUVROCSE.PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS DATE ) + 12 MONTHS >= FFF
AND
                    CAST( CONCAT( CONCAT( CONCAT(
CAST(CUVROCSE.FISCAL_YEARAS CHARACTER(4)), '-' ), TRIM( CAST(
CUVROCSE.PERIOD AS CHARACTER(2)) ) ), '-1' ) AS DATE ) <= FFF) AS WHAT2
    FROM (SELECT DISTINCT COMPANY AS CCC,
                CAST( CONCAT( CONCAT( CONCAT( CAST( FISCAL_YEAR AS
CHARACTER(4) ), '-' ), TRIM( CAST( PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS
DATE ) AS FFF
            FROM LAWCUSTDBF.CUVROCSE CUVROCSE
                WHERE CAST( CONCAT( CONCAT( CONCAT( CAST( FISCAL_YEAR AS
CHARACTER(4) ), '-' ), TRIM( CAST( PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS
DATE ) >= '2005-01-01' AND
                CAST( CONCAT( CONCAT( CONCAT( CAST( FISCAL_YEAR AS
CHARACTER(4) ), '-' ), TRIM( CAST( PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS
DATE ) <= '2005-11-01' AND
                COMPANY = 64  ) TEST

This doesn't:
select CCC, FFF, WHAT, WHAT2, (what / what2) as what3 from (

SELECT  CCC, FFF,

    (SELECT SUM( COALESCE( CUVROCNIE.BALANCE, 0 ) + COALESCE(
CUVROCNIBT.BALANCE, 0 ) ) AS FISCAL_YEAR_1
        FROM    LAWCUSTDBF.CUVROCNIBT CUVROCNIBT
                LEFT OUTER JOIN LAWCUSTDBF.CUVROCNIE CUVROCNIE ON
                CUVROCNIBT.COMPANY = CUVROCNIE.COMPANY AND
                CUVROCNIBT.FISCAL_YEAR = CUVROCNIE.FISCAL_YEAR AND
                CUVROCNIBT.PERIOD = CUVROCNIE.PERIOD
            WHERE   CUVROCNIBT.COMPANY = CCC AND
                    CAST( CONCAT( CONCAT( CONCAT( CAST(
CUVROCNIBT.FISCAL_YEAR AS CHARACTER(4)), '-' ), TRIM(
CAST(CUVROCNIBT.PERIODAS CHARACTER(2)) ) ), '-1' ) AS DATE ) + 11
MONTHS >= FFF AND
                    CAST( CONCAT( CONCAT( CONCAT( CAST(
CUVROCNIBT.FISCAL_YEAR AS CHARACTER(4)), '-' ), TRIM(
CAST(CUVROCNIBT.PERIODAS CHARACTER(2)) ) ), '-1' ) AS DATE ) <= FFF)
AS WHAT,

    (SELECT SUM(COALESCE(CUVROCTD.BALANCE,0) + COALESCE(CUVROCTDEB.BALANCE,0)
+ COALESCE(CUVROCTDTD.BALANCE,0) + COALESCE(CUVROCIB.BALANCE,0) + COALESCE(
CUVROCSE.BALANCE,0))/13 AS BALANCE
        FROM    LAWCUSTDBF.CUVROCSE CUVROCSE
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCIB CUVROCIB
            ON  CUVROCSE.COMPANY = CUVROCIB.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCIB.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCIB.PERIOD
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCTD CUVROCTD
            ON  CUVROCSE.COMPANY = CUVROCTD.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCTD.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCTD.PERIOD
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCTDEB CUVROCTDEB
            ON  CUVROCSE.COMPANY = CUVROCTDEB.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCTDEB.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCTDEB.PERIOD
            LEFT OUTER JOIN LAWCUSTDBF.CUVROCTDTD CUVROCTDTD
            ON  CUVROCSE.COMPANY = CUVROCTDTD.COMPANY AND
                CUVROCSE.FISCAL_YEAR = CUVROCTDTD.FISCAL_YEAR AND
                CUVROCSE.PERIOD = CUVROCTDTD.PERIOD
            WHERE   CUVROCSE.COMPANY = CCC AND
                    CAST( CONCAT( CONCAT( CONCAT(
CAST(CUVROCSE.FISCAL_YEARAS CHARACTER(4)), '-' ), TRIM( CAST(
CUVROCSE.PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS DATE ) + 12 MONTHS >= FFF
AND
                    CAST( CONCAT( CONCAT( CONCAT(
CAST(CUVROCSE.FISCAL_YEARAS CHARACTER(4)), '-' ), TRIM( CAST(
CUVROCSE.PERIOD AS CHARACTER(2)) ) ), '-1' ) AS DATE ) <= FFF) AS WHAT2
    FROM (SELECT DISTINCT COMPANY AS CCC,
                CAST( CONCAT( CONCAT( CONCAT( CAST( FISCAL_YEAR AS
CHARACTER(4) ), '-' ), TRIM( CAST( PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS
DATE ) AS FFF
            FROM LAWCUSTDBF.CUVROCSE CUVROCSE
                WHERE CAST( CONCAT( CONCAT( CONCAT( CAST( FISCAL_YEAR AS
CHARACTER(4) ), '-' ), TRIM( CAST( PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS
DATE ) >= '2005-01-01' AND
                CAST( CONCAT( CONCAT( CONCAT( CAST( FISCAL_YEAR AS
CHARACTER(4) ), '-' ), TRIM( CAST( PERIOD AS CHARACTER(2) ) ) ), '-1' ) AS
DATE ) <= '2005-11-01' AND
                COMPANY = 64  ) TEST ) as test5


The error I get is " 321

Processing ended because the highlighted statement did not complete
successfully"


What is the error? Am I doing too many subselects? The CUV files are views.

--
Mike Wills
koldark@xxxxxxxxx
http://mikewills.name
Want Gmail? Email koldark+gmail@xxxxxxxxx to get on my waiting list.

"There are 10 types of people in the world: those who understand binary, and
those who don't." -Unknown

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.