Page 1 of 1

MySQL result order

Posted: Fri Nov 02, 2007 9:32 am
by pettazz
If I were to have a MySQL database with a bunch of random things in it, each having a sequential 'id' field, and a field called 'active' with either a 1 or a 0, and i ran this query on it

"SELECT * FROM someDb WHERE active = '0' ORDER BY id ASC LIMIT 1"

would I always be returning the lowest id where active = 0? or is it dependent on the arbitrary ordering of the items in the database?

basically what I'm asking is will ORDER BY id ASC only order a results list or will it use the whole database?

Posted: Fri Nov 02, 2007 10:29 am
by louie35
it will use the entire table to sort it out

Posted: Fri Nov 02, 2007 10:39 am
by pettazz
awesome, that saves me a lot of work.

thanks.