You want the row with the max Version?  How about 

  SELECT Number, Version, Description
  FROM versions
  ORDER BY Version DESC
  LIMIT 1;

Michael

On Wed, 27 Feb 2002, Miguel Alves (SEP) wrote:

> Hi, 
> 
>       I'm using MySQL for the first time and have been trying to solve
> this basic SQL problem for 2 days... I have tried everything from
> using JOINs to local variables, searching in www.mysql.com and Paul
> DuBois MySQL book (Great book!), but failed to do this in a single SQL
> query has I had use to do with Microsoft SQL Server.
> 
>       The problem is;
> 
>       If I have this table (versions):
> 
> Number | Version | Description
>      1     |      A     | testing
>      1     |      B     | flying
> 
> 
> And use this query:
> 
> SELECT Number,MAX(Version),Description FROM versions GROUP BY Number;
> 
> 
> I will get:
> 
> Number | Version | Description
>      1     |      B     | testing
> 
> 
> Instead of:
> 
> Number | Version | Description
>      1     |      B     | flying
> 
> How can I make a single query that solves this problem ?!?! does anyone knows ?
> 
> Thanks, 
> 
> Miguel Lupi Alves
> Methods & Tools Specialist, Helpdesk Methods & Tools
> Customer Solutions
> 

Michael Stassen
University Information Technology Services
Indiana University Bloomington
[EMAIL PROTECTED]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to