Page 1 of 1

How to do it correct

Posted: Thu 03 Jan 2008 14:48
by Zero-G.
Hey

I do use your CRLab Solution myDIRECT 4.25 and mySQL Server 5.0.45-community-nt

So I do have 4 tables with different offers.
My boss wants, that the Invoice Number each year begins from 0. - So I think, that an extra invoice tabel with an autoincrement field will not be the right.
I have played around and have found out, that a Union of all 4 offer tables will bring me the max value of the invoice, which is saved in the offers table.
But is this SQL-technical correct!? - To read out a max value & add it with +1 and write it back as new invoice number!? - What is with the situation, when two people try to get the same number at the same time!? - Do I have to lock!?
Should I make a SP!?

Hope you understand what I try to do and maybe you can give me a good tipp, that will help me.

THX

Posted: Fri 04 Jan 2008 10:13
by Alexey.mdr
Unfortunately, we cannot provide a general advice on this topic because this is beyond the scope of our support program.

Posted: Sat 05 Jan 2008 08:27
by Zero-G.
Hey

It's OK. - But I just wanted a answer, which could advise a Syntax correct way.

THX

Posted: Wed 09 Jan 2008 11:00
by Alexey.mdr
Unfortunately we are not able to investigate your architecture deeply, but you can check if "LOCK TABLES" command is appropriate in your case. For more information please refer to MySQL manual.