neutrall Level: Scholar

 Registered: 28-03-2004 Posts: 43
|
Deleting only the old record
Hi, I would like to find a magic query! I whish I could have a query in mySQL that will delete all record except the last 5 entered. All record entered are timestamp. The problem, I have no clue where to start for such a query.
| DELETE FROM Previous_Login WHERE User_Id=1 ORDER BY LastConnect LIMIT 5,50; |
The LIMIT clause work on the DELETE command, but with only one argument. EX :
| DELETE FROM Previous_Login WHERE User_Id=1 ORDER BY LastConnect LIMIT 5; |
____________________________
A Stick give a wise man something to think about... and a fool, something to put in is mouth.
|