Hello.
You may use these queries:
select flight_id
,baseline*tan(radians(angle)) as attitude
from flights
where (baseline*tan(radians(angle))) =
( select max(baseline*tan(radians(angle)))
from flights f2);
+-----------+-----------------+
| flight_id | attitude |
+-----------+-----------------+
| 2 | 119.17535925942 |
+-----------+-----------------+
mysql> select flight_id, baseline*tan(radians(angle)) as attitude from
flights where (baseline*tan(radians(angle)))= (select
min(baseline*tan(radians(angle))) from flights f2);
+-----------+-----------------+
| flight_id | attitude |
+-----------+-----------------+
| 8 | 72.426658110531 |
+-----------+-----------------+
However, you should be aware about rounding errors and possibly
different results in 5.0 and older versions. See:
http://dev.mysql.com/doc/refman/5.0/en/precision-math.html
Mark Phillips <[EMAIL PROTECTED]> wrote:
> 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!
>
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]