monkeytooth Posted April 27, 2010 Share Posted April 27, 2010 I have a table that consists of many many rows. These rows are used for sorting my members saved lists. They take items from within the site add them to a list (or remove them). Each row is a different item for any given users list. The lists can be any size generally speaking. So that said Im not sure how to use this MAX properly. Anyone able give me a hand? Quote Link to comment https://forums.phpfreaks.com/topic/199958-php-mysql-max/ Share on other sites More sharing options...
monkeytooth Posted April 27, 2010 Author Share Posted April 27, 2010 You know what thinking and thinking and thinking about it.. MAX i really dont think is my solution. Im not trying to group things together and find the max based on the groups. I am trying to find the highest number. Period. If any of my members have a list of 5 lets say for example, I need to query my database specific to that user and find out what the last highest number is. So when they add a 6th in this case it will add +1 to the highest number and insert it into the DB.. but Im stuck I cant seem to get it to do that. Quote Link to comment https://forums.phpfreaks.com/topic/199958-php-mysql-max/#findComment-1049508 Share on other sites More sharing options...
Psycho Posted April 27, 2010 Share Posted April 27, 2010 You want to use ORDER BY and LIMIT. SELECT field FROM table ORDER BY field DESC LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/199958-php-mysql-max/#findComment-1049518 Share on other sites More sharing options...
monkeytooth Posted April 28, 2010 Author Share Posted April 28, 2010 Wow, Ridiculous.. I can't belive how gone my mind is.. the similest idea, and i cant fathom it i try to come up with an insane concept otherwise. Thank you for setting me straight, haha Quote Link to comment https://forums.phpfreaks.com/topic/199958-php-mysql-max/#findComment-1049720 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.