Patrioticcow
Patrioticcow

Reputation: 27038

mysql, how to delete selected data from database?

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

Answers (1)

Corbin
Corbin

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

Related Questions