hi,
I want to get the last three ids that are inserted into the database, where ids are auto-increment.
When i try to do this:
SELECT MAX(nieuwsid) AS nieuwsid FROM nieuws;
i get the highst id.
To get the last three ids, i want to store this highst id in a variable. Later i want to do this:
second=lastid -1;
third =second -1;
My problem is, how can i store the highes id into a variable.
In a situation like this i know how to do this:
java.sql.ResultSet result = statement.executeQuery(sql);
while(result.next())
{
String nieuwsid = result.getString("nieuwsid");}%>
But in the highesd id case, i dont know. Please help,
Thanx in advance
I want to get the last three ids that are inserted into the database, where ids are auto-increment.
When i try to do this:
SELECT MAX(nieuwsid) AS nieuwsid FROM nieuws;
i get the highst id.
To get the last three ids, i want to store this highst id in a variable. Later i want to do this:
second=lastid -1;
third =second -1;
My problem is, how can i store the highes id into a variable.
In a situation like this i know how to do this:
java.sql.ResultSet result = statement.executeQuery(sql);
while(result.next())
{
String nieuwsid = result.getString("nieuwsid");}%>
But in the highesd id case, i dont know. Please help,
Thanx in advance