Subject | Re: [firebird-support] Re: column name -> table name |
---|---|
Author | Lester Caine |
Post date | 2004-01-01T11:14:34Z |
> I forget give sqlquery example:Using .* is bad practice, you should list just the columns
> select table1.*,table2.* from table1,table2
> where table1.id=table2.t1_id
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