Subject Re: [firebird-support] Re: column name -> table name
Author Lester Caine
> I forget give sqlquery example:
> select table1.*,table2.* from table1,table2
> where table1.id=table2.t1_id

Using .* is bad practice, you should list just the columns
you need when building the query.

SELECT TABLE1.ID
, TABLE1.F1
, TABLE1.F2
, TABLE1.F3
, TABLE2.ID
, TABLE2.F1
, TABLE2.F2
, TABLE2.F3
FROM TABLE1
JOIN TABLE2
ON TABLE2.ID = TABLE1.ID

Once you have this, you can either
ORDER BY TABLE1.F1
or
ORDER BY 2
Where 2 is the second column. Using .* means that you do not
know what order the columns are in, and this can change, for
example if more columns are added to TABLE1

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services