I have a table with the following fields :
PersonnelTable Table fields:
* FirstName
* LastName
* Address
* IdNumber
* UserName
* Password
* Status
In that table I allow duplicate records .
I want to remove one occurrence from that table where :
String sqlStatement = "DELETE FROM `PersonnelTable` WHERE `Password` = ? AND `UserName` = ? ";
m_prepared.setString(1, _password); // set the password
m_prepared.setString(2, _username); // set the user-name
int rowsAffected = m_prepared.executeUpdate();
But that query would remove all the records where Password = ? and UserName = ?
How can I remove only one record using that query ?
Thanks
The
LIMITclause can be used inUPDATEorDELETEstatements too: