Tag: mysql

  • mysql – identifying number of duplicates in a table

    So my little query adventures with mySQL continues. Here’s another unique problem: There are duplicates in the table as there is no field that was setup as primary index. So how do we know how many do we have? Well assume that the duplicate values happen on the “Phone Number” of the client. Here’s the…

  • Mysql – Appending data

    Problem: Appending data from one table to another table where duplicate might exist. Solution: A simple “Insert into table2 select * from table1” query will give errors saying “duplicate records exist”, to go around it, the following query should do the job: INSERT INTO MASTERTABLE SELECT * FROM NEWTABLE WHERE NEWTABLE.`UNIQUEID` NOT IN (SELECT `UNIQUEID`…

  • MySQL non-matching Records

    Problem: Finding records in Table b that do not match records in Table a This sort of problem may arise when you need to scrub a file against another or run a duplicate scan on a file against another to weed out any duplicates that may exist prior to doing whatever it is you need…

  • mysql – matching records

    Problem: Find records that match within two tables, TableA and TableB. Solution: Use a simple SELECT statement with a defined WHERE clause Lets assume that TableA and TableB have a field called “Phone” which contains the phone number of the clients and these numbers are obviously stored in a unique index. So what we are…

  • mysql – scrubbing files against others

    Problem: TableA contains a customer database TableB contains new names that you want to match against your customer database and remove all the names that are already customers. Solution: Use “LEFT JOIN” property of mysql to carry out the task. Lets assume that TableA and TableB have a field called “Phone” which contains the phone…