In SQL how would I insert into a MAX count of another column
So I have this
INSERT INTO USER(id,name,employee_code,email) VALUES (3,john,(SELECT MAX(employee_code)+1 FROM USER),"john@example.com");
However this doesn’t work with the syntax… basically it’s like an autoincrement that I have to self build because the employee_code sometimes equals 0 for temporary employees so I need a command to take the max code in their and add one.
Do away with the VALUES statement and use a select instead: