delete data from mysql table based on multiple conditions

时间:2015-06-15 15:04:24

标签: php mysql python-2.7

i need to delete rows from MySQL table which is very huge.I have multiple conditions check before deleting the data. my table looks like: data(table name):

   name  mobile email address source
    xyz   871    a@y.com        1.txt
    bac   123     null          2.XLS
    TST   456     B@C.COM       3.xls
    yup   897     null          abcde
    web   null    D@gmail.com   hjbsb

so basically i need to delete the rows where value in Source doesnt end with either .TXT or .txt or .xls or .XLS. source is the file-name from which data has been captured.

1 个答案:

答案 0 :(得分:5)

Delete from table_xyz where right(lower(source),4) not in ('.txt','.xls','xlsx')