At 17:51, 19990914, Mr. Anthony R.J. Ball wrote:
> Sorry... I found this in the docs now... doesn't mean I like it... sigh.
>> I am trying to basically select MAX(order_number) + 1 from the table I
>> am in on the insert.
Yep. Either use an AUTO_INCREMENT column (this is exactly the kind of
thing AUTO_INCREMENT is for, probably), or if you can't do that, then
do something like:
LOCK TABLES foo WRITE;
SELECT MAX(order_number)+1 FROM foo; /* store in <next_order> */
INSERT INTO foo (order_number, etc) VALUES (<next_order>, 'bar');