Im creating a ticketing system and this is my table structure:
CREATE TABLE tix_sip
(
tktNum INT UNSIGNED NOT NULL,
sipNum INT UNSIGNED AUTO_INCREMENT,
PRIMARY KEY( sipNum ),
FOREIGN KEY(tktNum) REFERENCES Tix (tktNum)
);
what I would like to happen with my sipNum
is to be numbered according to year.
Example: 20140001, 20140002, ..20140334, 20140335....
How do I make it change the first 4 digits automatically so everytime next year comes, it will create new\another set of AUTO_INCREMENT
ed numbers
Example: 20150001, 20150002........ 20160001, 20160002..
btw, Im using php code for my program, in case that could help if a solution would be creating a function. Thanks