"Keith" <[EMAIL PROTECTED]> wrote:
> i'm trying to find the max value of a certain field and return a field linked with 
> the max value. The tables:
>
> planets--
> population
> government
> sysID
>
> systems--
> sysID
>
>
> For examples sake lets say we are searching through three sysID's. For each sysID I 
> want to look in planets and calculate the largest population value where the sysID's 
> are the same then return the government value for the planet with the largest 
> population for each sysID.

If you use 4.1.x version of MySQL you can use subqueries to get needed result. If you 
use older version you can use temporary table and JOIN or "MAX-CONCAT" trick:
        http://www.mysql.com/doc/en/example-Maximum-column-group-row.html



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [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]

Reply via email to