chanchelkumar Posted April 2, 2008 Share Posted April 2, 2008 Hi all, I am working with some random numbers... I want to get the largest number in a field before inserting a value.. Any body please help me... I want to rename a variable with that number+1 so as to get it unique, before insertion.. Please help me... Link to comment https://forums.phpfreaks.com/topic/99188-get-the-largest-value-from-a-mysql-table/ Share on other sites More sharing options...
pocobueno1388 Posted April 2, 2008 Share Posted April 2, 2008 Why not just put an auto-increment field in the table? To get the max value +1 you would do this: SELECT MAX(field)+1 AS highest FROM table Link to comment https://forums.phpfreaks.com/topic/99188-get-the-largest-value-from-a-mysql-table/#findComment-507462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.