Using MySQL 5.0. I'm trying to select a set of data and somehow pick out rows with the smallest number in one of the columns.
Example:
Expand|Select|Wrap|Line Numbers
- SELECT first_name, LEAST(height)
- FROM people
- INNER JOIN heights ON name_id_pk=name_id_fk
The data in the table would be something like
people.first_name: heights.height:
Henry 1.8
Henry 1.6
Henry 1.9
Arthur 1.5
John 1.8
John 1.7
The select query would pick out Henry (1.6), Arthur (1.5), John (1.7) as they are the smallest of each person with the same name.
Hopefully that makes sense. Any help is much appreciated.
Henry