Quote:
Originally posted by mrbear
i want to get the last value of the database and the database look like this
table name prospec
TranID data item
1 02/02/2004 2
2 02/02/2004 2
3 02/02/2004 3
4 02/02/2004 3
i want to get the value (4) which auto generate by itself
i try "select TranID from prospec order by TranID desc limit 1"
then when i run it then this error came out "incorrect syntax new 'limit' "
|
For MS-SQL 7.0 or later, you probably want:
PHP Code:
SELECT TOP 1 TranID
FROM prospec
ORDER BY TranID DESC
You can actually get the same result much more portably by using:
PHP Code:
SELECT Max(TranID)
FROM prospec
This should work on any database that supports SQL-89 or later.
-PatP