Skip to main content

Posts

Showing posts from May, 2013

HOW TO DELETE DUPLICATE RECORDS FROM A MYSQL TABLE BY KEEPING ONLY ONE RECORD WITH HIGHEST OR LOWEST ID VALUE

HOW TO DELETE DUPLICATE RECORDS FROM A MYSQL TABLE BY KEEPING ONLY RECORD WITH HIGHEST OR LOWEST ID VALUE

Deleting duplicate records from a mysql table by keeping only record with highest or lowest id value.

Here I am explaining this with an example table. Let the table name be "tbl_films" . The table has fields "fId" and "fName"


tbl_films
fId | fName
------------
1 | Film1
2 | Film2
3 | Film1
4 | Film1
5 | Film3

How can We do INSERT and UPDATE through a single MySQL Query? - "INSERT ..... ON DUPLICATE KEY UPDATE" Syntax

How can We do INSERT and UPDATE through a single MySQL Query? - "INSERT ..... ON DUPLICATE KEY UPDATE" Syntax

INSERT and UPDATE Actions in one MySQL Statement

Usually Update functions will check for a record with given key and if it exist then function will execute the UPDATE Query else perform an INSERT Query. So here happens a SELECT query on Table Followed by INSERTION / UPDATION of a Record.

You can do this in single MySQL query. How?


Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »
Member
Search This Blog