Subject Re: How to get table alias from SQL for columns
Author rogervellacott
Trying to work out the SQL field number from a column number has a
number of pitfalls, especially if you use calculated fields, or your
column order is different to field order, or you only show some of
the fields as columns.

For what it's worth, I solved the identical problem in Delphi with a
function which takes the SQL text, and a field name, and returns the
field name prefixed with an alias. It only works if there is a
single "*" in the query. You can have the Delphi code if you are
interested, especially if you can improve it for me.

Roger Vellacott
Passfield Data Systems Ltd

--- In, Roman Rokytskyy
<rrokytskyy@...> wrote:
> > Thanks Roman for the answer. Can you tell me where can I register
> > feature request?
> I have bad news for you - at the moment I'm not able to get the
> alias for the column. I was confused by the new info constant in FB
> however it turns out that it is used for different purposes. So at
> moment 2.1.3 release won't have new method.
> However, your issue is easily solved by using the column index -
you can
> use "select A.*, B.* from TABLE_A A left outer join TABLE_B on ....
> order by 1, 3, 5". And this is probably even easier for you, since
> always know the column index when user clicks on the header.
> Roman