Reputation: 27038
i have a table like this:
table 1
id time
122639 1315510027
122639 1315510026
122639 1315510027
122639 1315510030
122640 1315510366
how can i make a query that deletes everything but 122640 1315510366
? even if i have to use php
any ideas?
Thsnks
Upvotes: 0
Views: 265
Reputation: 33437
DELETE FROM table1 WHERE id != 122640;
Note: if you have other entries with that ID, you'll need to do id != 122640 AND time != 1315510366;
http://dev.mysql.com/doc/refman/5.0/en/delete.html
Upvotes: 4