On 26/02/2020 10:27, Vik Fearing wrote:
> WITH
> u (invoice_number) AS (
> UPDATE invoice_numbers
> SET invoice_number = invoice_number + 1
> WHERE country = $1
> RETURNING invoice_number
> ),
> i (invoice_number) AS (
> INSERT INTO invoice_numbers (country, invoice_number)
>
t;
> > I'm trying to find a way to increment an invoice number. And i think it
> > would be pretty straight forward just using a SERIAL int. But as we're
> > selling across multiple countries, i need the invoice increment to be
> reset
> > by a country_id. an
her reasons). In many jurisdictions,
invoice numbers must not have gaps. You may still be able to use
sequences, but you have to carefully consider when to increment them.
> But as we're selling across
> multiple countries, i need the invoice increment to be reset by a country_id.
By "
On 26/02/2020 09:38, Søren Frisk wrote:
> Hi all
>
> I'm trying to find a way to increment an invoice number. And i think it
> would be pretty straight forward just using a SERIAL int. But as we're
> selling across multiple countries, i need the invoice increment to b
On Wed, 26 Feb 2020 at 09:54, Søren Frisk wrote:
> Hi all
>
> I'm trying to find a way to increment an invoice number. And i think it
> would be pretty straight forward just using a SERIAL int. But as we're
> selling across multiple countries, i need the invoice inc
Hi all
I'm trying to find a way to increment an invoice number. And i think it
would be pretty straight forward just using a SERIAL int. But as we're
selling across multiple countries, i need the invoice increment to be reset
by a country_id. any good way to achieve this in a dynamic