I have a simple table Team: id
, short_id
, name
, championship_id
What I need is that for each team short_id increments but only for one championship. When championship_id changes, short_id reset to 0.
I could do it manually, before creating I get max(short_id), and insert the corresponding value, but I wonder if there is any better solution.
Anyone has an idea?
via Juliatzin del Toro