ninedoors Posted August 11, 2008 Share Posted August 11, 2008 I would like to be able to select the row id of a given column that has the minimum value in that column. So if I had a column named darts with values (0, 4, 6, 2, 0, 5, 7) in it. How do I select the row id (row_id)for one of the columns with 0 in it. Right now I am trying this but it isn't working: $query = "SELECT row_id, MIN(darts) FROM schedule_temp GROUP BY row_id"; I understand why it isn't working but is there a mysql function that does this or do I have to pull out all the values and compare them in the script? Quote Link to comment Share on other sites More sharing options...
ninedoors Posted August 11, 2008 Author Share Posted August 11, 2008 Wow, I'm dumb. I guess I could jsut use ORDER BY and use the first record returned. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.