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 Link to comment https://forums.phpfreaks.com/topic/58171-solved-mysql-select-largest-number/ 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 Link to comment https://forums.phpfreaks.com/topic/58171-solved-mysql-select-largest-number/#findComment-288505 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 Link to comment https://forums.phpfreaks.com/topic/58171-solved-mysql-select-largest-number/#findComment-288506 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. Link to comment https://forums.phpfreaks.com/topic/58171-solved-mysql-select-largest-number/#findComment-288508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.