Finding last number in database

  • Thread starter Thread starter Big E
  • Start date Start date
B

Big E

I'm using VB Windows Forms and SQL Server.
I have a row in a database that is not a identity column but it contains
numbers.
I want to lookup the last number for a particular group of records and find
the last number in a column.
EX: In the Print Number column I have:
xyz 1
acb 2
def 3

I want to be able to find the number 3 and add 1 to it equaling 4 so I can
use that for a new record.

Thanks.

Erik
 
If by "last" number you mean the "highest" number then you could use a
simple SQL query such as...

"SELECT MAX(YOUR_FIELD) FROM YOUR_TABLE"

You can even add a "WHERE" clause if there are additional fields that need
to be compared.
 
Back
Top