Subject Re: Restriction on Field selection
Author sathiesh81
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> > Hi Adam
> >
> > Is there any remidy to overcome the above problem.
> >
> > Thanx
> > Sathiesh
> >
>
> Not the way you are attempting to solve whatever problem you are
> solving. There is an implementation limitation you are hitting in
the
> number of fields that can be included in a sort, and a sort is
> required to do the distinct.
>
> Perhaps explaining the problem you are trying to solve may allow us
to
> propose another solution, but all software has design limitations,
> this is just one of Firebirds.
>
> Adam
>

Hi Adam

The output i require is for the following query
I have six tables .. and i have to retrieve about 300 fields from all
the six tables. The primary key
for all the tables is the "CO_CODE" and the "YEAR" field. In each of
the table there are multiple records for
each "CO_CODE" and "YEAR". I want to fetch the distinct fields only.

My query is somewhat like this

SELECT DISTINCT TADMIN.NAME AS "A",TAG.STO AS "B",TLATFIN.YEND
AS "C",TBS1.CPY AS "D",TBS2.OTH AS "E",TNETBLOCK.ESTCAP AS "F",....

FROM
(SELECT * FROM TADMINISTRATOR) AS TADMIN,
(SELECT * FROM AG) AS TAG,
(SELECT * FROM LATFIN) AS TLATFIN,
(SELECT * FROM BS1) AS TBS1,
(SELECT * FROM NETBLOCK) AS TNETBLOCK,
(SELECT * FROM BS2) AS TBS2

WHERE TADMIN.CO_CODE = TAG.CO_CODE AND
TAG.CO_CODE = TLATFIN.CO_CODE AND
TADMIN.CO_CODE = TBS1.CO_CODE AND
TADMIN.CO_CODE = TNETBLOCK.CO_CODE AND
TNETBLOCK.CO_CODE = TLATFIN.CO_CODE AND
TBS1.CO_CODE = TLATFIN.CO_CODE AND
TADMIN.CO_CODE = TBS2.CO_CODE AND
TBS2.CO_CODE=TLATFIN.CO_CODE AND
TAG."YEAR" = TLATFIN.LATEST AND
TBS1."YEAR" = TLATFIN.LATEST AND
TNETBLOCK."YEAR" = TLATFIN.LATEST AND
TBS2."YEAR"=TLATFIN.LATEST AND
TAG."YEAR" = TBS1."YEAR" AND
TAG."YEAR" = TNETBLOCK."YEAR" AND
TAG."YEAR" = TBS2."YEAR"

Thanx
Sathiesh