Subject | Re: [firebird-support] dynamic column alias |
---|---|
Author | Aage Johansen |
Post date | 2007-06-20T21:23:18Z |
crizoo4712 wrote:
1. First select runs all the (select header_N from table_N where..),
and save them in variables TEMP_N
2. You create the text for the "real" select (e.g. in Delphi)
'select DATA_1 as '+TEMP_1+', DATA_2 as '+TEMP_2 '+
'from ...'+
'where ... '
--
Aage J.
> Hello all,You might consider splitting the work: 2 selects:
>
> I have two tables. One of them contains headers (head_1, head_2, ...)
> which contain field names like "STREET", "ZIP CODE", ...
> In other cases this could be "PHONE NUMBER" for head_1, "MAIL
> ADDRESS" for head_2 and so on..
>
> In another table the values are stored in varchar-fields (data_1,
> data_2, ...) They could be "CHURN CREEK RD." for data_1, "471109" for
> data_2, or "001 6767 689903" for data_1, "noone@..." for
> data_2 and so on.
>
> In a select I want to name the output-columns with aliases depending
> on the values stored in the headers and depending on a component_id
> which determines the stored object (address-data or contact-data..).
>
> In other words, I want to do something like the following:
>
> "select data_1 as (select header_1 from table_1 where..)
> from table_2 where component_id = ..."
>
> I know, that this is not possible in sql, but does someone's got an
> idea for a workaround?
>
> regards, Christoph
1. First select runs all the (select header_N from table_N where..),
and save them in variables TEMP_N
2. You create the text for the "real" select (e.g. in Delphi)
'select DATA_1 as '+TEMP_1+', DATA_2 as '+TEMP_2 '+
'from ...'+
'where ... '
--
Aage J.