sandrob57 Posted July 3, 2007 Share Posted July 3, 2007 My current query: $result = dbquery("SELECT user_id FROM fusion_ip WHERE user_id='".$userdata['user_id']."'"); I want the query to select the row with the highest number (or, in this case, datestamp). So if this were the database ___ip_id____ ___user_id___ ____ip____ ____date____ 1 1 7.777.77.7123413243 2 1 5.555.55.5343434343 3 1 7.777.77.7543245234 The query would select row 3 because the date is the most recent Quote Link to comment Share on other sites More sharing options...
corbin Posted July 3, 2007 Share Posted July 3, 2007 SELECT user_id FROM fusion_ip WHERE user_id = '{$userdata['user_id}' ORDER BY date DESC LIMIT 1 Quote Link to comment Share on other sites More sharing options...
sandrob57 Posted July 3, 2007 Author Share Posted July 3, 2007 i love how the answers are always so damn simple this is what not programming for a month does to you thanks, though Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 3, 2007 Share Posted July 3, 2007 Also u can use max clause for multiple entries in the whole table. 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.