I have two columns 'serial' and 'type' in table 'bills'
I want to get the max serial +1 where type = x
the standard statement:
"SELECT ISNULL(MAX(serial), 0) + 1 FROM bills
WHERE type = x"
take a huge response time if there is a huge number of records.
Is there any better idea?