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.
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.
thanx
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.