File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes maximum value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "maximum value " Watch "maximum value " New topic
Author

maximum value

Manuel Paco
Ranch Hand

Joined: Sep 23, 2001
Posts: 58
Help please
What is the fastest way to get the maximum value in the field.
I need to get this value to my variable and use it as a base for deriving my invoice number.
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
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.
Manuel Paco
Ranch Hand

Joined: Sep 23, 2001
Posts: 58
Thank you.
Select MAX(number) from . . .
How do I get value from that?
Manuel Paco
Ranch Hand

Joined: Sep 23, 2001
Posts: 58
I got it. Works. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: maximum value
 
Similar Threads
passed at 354
Passed SCJD with 374/400 B&S
Java Media Framework Install Help on Red Hat 9.0
Need to convert a float value into a normal value
How can Whizlab Weblogic Exam simulator help?