Archive

Posts Tagged ‘sql’

SQL statement to list duplicate contents

July 10th, 2009 admin No comments

You will need this SQL statement to list all duplicate contents in a table

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

source

Categories: database Tags: , , ,

MySQL search and replace

May 20th, 2009 admin No comments

I’ve been doing data cleansing of one of my project. Then there was a need to find some abbreviation to be replaced by the real words.

Here I did with mysql statement.

update property set town = replace(town,’tmn’,'taman’)

In general:

update TABLENAME set FIELDNAME = replace (FIELDNAME, searchstr, replacestr)

Categories: technology Tags: ,