Les,


I believe it depends on the database.  I have seen queries work this way on
some and break on others.


I think that the best way to do it would be to change your order by line to:


order by (69.1 * (longitude = 104.825814))


Steve

-----Original Message-----
From: Les Irvin [mailto:[EMAIL PROTECTED]
Sent: Friday, March 05, 2004 1:37 PM
To: CF-Talk
Subject: Ordering a query by a dynamic field

Is it possible to order a query by a field produced within that same query?
This query fails at the "Order by" statement:

<CFQUERY NAME="Result" DATASOURCE="foo">
  SELECT City,
   State,
   Username,
   Longitude,
   (69.1*(longitude - 104.825814) as distance
  FROM personal
  ORDER BY distance
</cfquery>

The "distance" field is (obviously) not a field in the table being queried.

Thanks in advance for the help,
Les
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to