Greaser9780 Posted February 23, 2007 Share Posted February 23, 2007 I want to select name from my table I am trying to get a result that has the lowest activate # and the lowest teamid Tried this but I don't know how to word it. $sql1 =mysql_query("SELECT name FROM `teams` ORDER BY activate,teamid ASC LIMIT 1"); Quote Link to comment Share on other sites More sharing options...
mbtaylor Posted February 23, 2007 Share Posted February 23, 2007 $sql1 =mysql_query("SELECT name FROM `teams` ORDER BY activate DESC, teamid DESC LIMIT 1"); ASC is ascending, DESC descdending. So if you sort by DESC then the lowest one should be first. Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 23, 2007 Author Share Posted February 23, 2007 TYVM Quote Link to comment Share on other sites More sharing options...
mbtaylor Posted February 23, 2007 Share Posted February 23, 2007 You might want to read up on the mysql min function too. You can select min or max value from a db using something like: SELECT min(userID) from site_users; 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.