Skip to main content

Posts

Showing posts from February, 2012

How to find duplicate records in a table. - MySQL or SQL Query to find duplicates in a table

How to find duplicate records in a table?

MySQL or SQL Query to find duplicates in a table

suppose you have a table like this which represent some user transactions:

Table Name : tbl_user_trans

transIduserIdtransDatetransAmount1000USR0342012-01-01300.251001USR0042012-01-08100.051002USR0302012-01-1130.591003USR0342012-01-081000.651004USR0502012-02-0119.251005USR0342012-02-03403.25


If want to find all Users from the transaction table who had made transactions more than once , then you have to do like this:


SELECT userId, COUNT(userId) AS HowMany FROM tbl_user_trans
GROUP BY userId
HAVING ( COUNT(userId) > 1 )


The query will return
userId      HowMany USR034     3
You could also find users who had made single transaction, Do it like this:


SELECT userId
FROM tbl_user_trans
GROUP BY userId
HAVING ( COUNT(userId) = 1 )


The query will return:

userId       USR004 USR030 USR050



From User comments:
what if I need to check for a particular record not a column?
i.e (How many duplicated record are th…

HOW TO CREATE WEBSITES DRIVEN BY SEO FRIENDLY URLS WITH OUT USING HTACCESS

CREATING WEBSITES DRIVEN BY SEO FRIENDLY URLS WITH OUT USING HTACCESS

In this article I will explain how we can create websites which are driven by seo friendly urls with out using htaccess.

To read about SEO and HTaccess please read how to create SEO friendly url driven websites using HTaccess rewrite function

When we use HTACCESS for SEO friendly redirections, we use mod_rewrite module of apache. We can create seo friendly url driven site with out using the htaccess mod_rewrite module functions.

I will try to explain it very simple:

take this url path as example "http://www.myphpwebsite.com/"

for this you need a index file in the root folder
like this : http://www.myphpwebsite.com/index.php

The content for this page will be populated based on a parameter "content"

like this : http://www.myphpwebsite.com/index.php?content=home

so content of this page changes as the parameter value changes, the contents may be driven from database or include files

sample calls
http…


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