> It is a very simplistic approach since you do not take into account
> holidays. But if it meets your needs what you want is the modulo operator
> (
> "%"; "mod(x,y)" is the equivalent function ) which performs division but
> returns only the remainder.
>
> N % 14 = [a number between 0 and (14 - 1)]
>
> N = 7; 7 % 14 = 7 (0, 7 remainder)
> N = 14; 14 % 14 = 0 (1, 0 remainder)
> N = 28; 28 % 14 = 0 (2, 0 remainder)
> N = 31; 31 % 14 = 3 (2, 3 remainder)
Ah, thank you, David. This gives me some good knowledge that I
was missing! I know about %, but I was fumbling a bit with it in
plpgsql, and your examples helped.
Thanks!
Benny
--
"Hairy ape nads." -- Colleen, playing Neverwinter Nights