[GENERAL] Restart increment to 0 each year = re-invent the sequences mecanism ?

2004-04-26 Thread Bruno Baguette
Hello, I have to design a table wich will store some action reports. Each report have an ID like this 1/2004, 2/2004, ... and each years, they restart to 1 (1/2004, 1/2005, 1/2006,...). So, I was thinking to split that in two fields : one with the increment and one with the year. But I don't

Re: [GENERAL] Restart increment to 0 each year = re-invent the sequences mecanism ?

2004-04-26 Thread Bruno Wolff III
On Mon, Apr 26, 2004 at 09:38:41 -0400, [EMAIL PROTECTED] wrote: You don't have to mess with sequences. If there are two fields ID and year then the next number is: next_number := ( select ID from table_name where year = year_from_current_date order by ID desc limit 1 ) + 1; Gee, I