List:General Discussion« Previous MessageNext Message »
From:Mark Phillips Date:December 11 2005 5:38pm
Subject:Need Help with a query
View as plain text  
I have a table with several columns. The ones of interest are flight_id, 
angle, and baseline. I want to find the flight_ids for the flights with the 
maximum and minimum altitudes, where altitude=baseline*tan(radians(angle)).

For example, 
Flights
+------------+----------------+---------------+
| flight_id | angle        | baseline  |
+------------+----------------+---------------+
|       1     | 37.00000 | 100.00000 |
|       2     | 50.00000 | 100.00000 |
|       3     | 48.00000 | 100.00000 |
|       4     | 40.00000 | 100.00000 |
|       5     | 44.00000 | 100.00000 |
|       6     | 40.00000 | 100.00000 |
|       7     | 45.00000 | 100.00000 |
|       8     | 44.00000 |  75.00000 |
|       9     | 57.80000 |  75.00000 |
+------------+----------------+---------------+

The result I am looking for are:

Maximum altitude:
+------------+----------------+
| flight_id | altitude     |
+------------+----------------+
|       2     | 119.17536 | 
|       9     | 119.17536| 
+------------+----------------+

Minimum altitude:
+-----------+-----------+
| flight_id | altitudeM |
+-----------+-----------+
|         8 |  72.42666 |
+-----------+-----------+

Thanks for any help you can provide!

-- 
Mark Phillips
Phillips Marketing, Inc
mark@stripped
602 524-0376
480 945-9197 fax
Thread
Need Help with a queryMark Phillips11 Dec
  • Re: Need Help with a queryGleb Paharenko12 Dec