Multiple increments in table Let's say I have a table which stores different bills.  

There are multiple departments using this database and every department  needs to use their own incremental numbering for the bills.  

I do not want to use multiple tables, so I have an issue what the best method for this issue is.  

I have come up with an suggestion by myself, but I think this is not a good solution. Namely keep a column DepartmentBillId and keep track of the numbering in PHP (this will be the easiest way though, but I have multiple users so this could actually cause conflicts).

I hope somebody can guide me in the best direction!
For me the way to go is that you create a pre-insert trigger that will set the BILL_ID for that department when no BILL_ID was given. To get the next BILL_ID you could use a table that holds the last BILL_ID per department. An other way is to get the MAX(BILL_ID) for that department and add 1 to it. When you work with multiple users then the first solution is better and faster. The primary key for the BILLS table would be DEPARTMENT_ID, BILL_ID and perhaps even YEAR if you need to start at 1 when the new year starts.