Friday, June 17, 2016

Delete Duplicate data in database (MYSQL)

DELETE a
FROM tpcap_dailycheck as a, tpcap_dailycheck as b
WHERE
          (a.partno   = b.partno OR a.partno IS NULL AND b.partno IS NULL)
      AND (a.del_date = b.del_date OR a.del_date IS NULL AND b.del_date IS NULL)
      AND (a.qty = b.qty OR a.qty IS NULL AND b.qty IS NULL)
      AND a.no > b.no;