Subject Re: order by with a calculated field
Author bwc3068
Thanks for the response!

Ahhh yes, makes sense....the field is calculated on the client so I can't get the server to sort by it.

the inner join would certainly give me the results I need but, unfortunatenly, the query, application and GUI for the end users are all highly integrated and it's not that easy for me to have a specific inner join query instead of the program's standard query.

but your suggestion would certinaly work. Sounds like I'll have to weigh if I setup a specific query for that result vs. just not let them do it OR have them export the query with the OwnerName into Excel and sort it there.

thanks again for the reply!
kelly

> The field is calculated in your Delphi application by your Delphi code
> at the client side. The SQL is executed by the Firebird server at the
> server side. Consequently Firebird has no idea that the calculated field
> even exists. Only your Delphi code knows about it.
>
> You either need to use Delphi's client-side sorting (if the components
> you use support that), or construct the complete query in SQL, so it's
> all executed at the server.
>
> May I suggest a join between your equipment table and the owner table:
>
> select Owners.OwnerName, Equipment.*
> from Owners
> inner join Equipment
> on Equipment.OwnerUniqueKey = Owners.UniqueKey
> where (your selection criteria)
> order by Owners.OwnerName
>
> This is the most common way to do it, btw.
>
> Kjell
> --
> --------------------------------------
> Kjell Rilbe
> DataDIA AB
> E-post: kjell@...
> Telefon: 08-761 06 55
> Mobil: 0733-44 24 64
>