Revision: 18391
Updated Code
at September 29, 2009 14:00 by cherbert
Updated Code
INSERT INTO jobs (companyid,clientref,jobid) VALUES (8,2,IFNULL((SELECT max(b.jobid)+1 FROM jobs b where b.clientref=2),1) );
Revision: 18390
Updated Code
at September 29, 2009 14:00 by cherbert
Updated Code
// MySQL Insert Unique Reference using MAX() to obtain latest value // Alternate solution to using Composite Primary Keys which INNODB engine does not support. INSERT INTO jobs (companyid,clientref,jobid) VALUES (8,2,IFNULL((SELECT max(b.jobid)+1 FROM jobs b where b.clientref=2),1) );
Revision: 18389
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 29, 2009 13:56 by cherbert
Initial Code
INSERT INTO jobs (companyid,clientref,jobid) VALUES (8,2,IFNULL((SELECT max(b.jobid)+1 FROM jobs b where b.clientref=2),1) );
Initial URL
Initial Description
MySQL Insert Unique Reference using MAX() to obtain latest value Alternate solution to using Composite Primary Keys which INNODB engine does not support.
Initial Title
MySQL Insert Unique Reference
Initial Tags
mysql
Initial Language
MySQL