Jake Stride writes:
> I thought of doing:
>
> SELECT max(jobno) from jobs where companyid=1;
>
> Then use the result as the job number, is there a way I can lock the table
> to do this or a better way of achieving the required result.
I think SELECT FOR UPDATE should work fine here.
See: http://www.postgresql.org/docs/7.4/static/mvcc.html
HTH
Andreas