简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM