This code is not working
INSERT INTO student_profile set student_id =MAX(student_id )+1;

any body help me,
my table student_id is abc0001, while inserting another student details it will be abc0002 but not working.

inserting any record it will be autoincrement. any body help me.

Is it stored as a VARCHAR? You cannot just increment that. It should be possible to write a stored procedure for it, but usually such a composite ID is stored in separate columns (merged when queried). Usually such IDs are built from an AUTOINCREMENT column. Using MAX is dangerous, it could result in duplicates or errors, depending on your table structure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.