This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Fastest way? Use an AUTONUMBER field in something like Oracle or MySQL - let it get the next number, and then build your invoice number off of it. Alternatively,
Make sure you synchronize invoice number creation/usage so that you don't reuse your number (or have some other scheme for unique invoice number creation - using a unique key on invoice number is typical, to validate that created numbers are unique). Depending on your database/enterprise architecture, you could theoretically also write a trigger that creates the invoice number upon insert of a record. The advantage there is that you know everyone inserting a record is using the same algorithm for creating an invoice number.
Joined: Sep 23, 2001
Thank you. Select MAX(number) from . . . How do I get value from that?