mysql - Query to autonumbering manually by PHP Script -


i got problem querying auto number. got table tbunit contain unit_id, unit_name , table tbstudent contain stu_id, stu_name. stu_id comes unit_id + year + 0000 (4 digits autobumbering).

i can create auto numbering if not seeing unit_id, right now, want create data autonumbering depend on unit_id, example: a20150001, a20150002, b20150001 (restart 1 because no b unit before), ...

any idea how create condition? auto numbering depending on id @ other tables. i'm using mysql , php script.

if understand correctly, wouldn't recommend trying use autonumbering.

instead, populate separate table attribute based on rules , values in source table. think $string = sprintf("%04d", $digits); should work last 4 digits. can current year date("y") in case not aware. then, latest unit (e.g. "b") unit table, concatenate of , store in student table.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -