I got a problem with querying for auto number. I got a table tbUnit which contain unit_id, unit_name and table tbStudent which contain stu_id, stu_name. Stu_id comes from unit_id + year + 0000 (4 digits autobumbering).
I can create auto numbering if not seeing the unit_id, but right now, I want to create data autonumbering depend on unit_id, for example: A20150001, A20150002, B20150001 (restart from 1 because no B unit before), ...
Any idea how to create those condition? Auto numbering depending on ID at other tables. I'm using MySQL and PHP script.