|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I am trying to write a SQL(mySQL) query that would allow me to:
Select any 2 records with the minimum numeric value in a certain field (let's say minimum age). Also, if for example, 10 is the minimum age and there is only one record in the table with that age, that record should be selected along with the record where the age is higher (say 11). Thanks in advance |
|
#2
|
||||
|
||||
|
couldn't you do something like this:
select age from table order by age asc which will get all of the ages, and sort them in accending order. then you can just get the first two rows. you could possibly put a LIMIT on there to only retrieve two rows, but i've never used limits before... ---John Holmes... |
|
#3
|
|||
|
|||
|
select * from table order by age limit 0,2
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Selecting 2 records with minimum 'age' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|