Searchin for multiple similar entries.

This is a discussion on Searchin for multiple similar entries. within the MySQL Database forums, part of the Database Forums category; Hi, I am looking for double entry in my database. So that, for example, if the name bob was listed ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-04-2006
Simon
 
Posts: n/a
Default Searchin for multiple similar entries.

Hi,

I am looking for double entry in my database.
So that, for example, if the name bob was listed more than once I would get
the name and the number of times it is listed.

What select statement should I use to list all the similar entries?

Regards,

Simon


Reply With Quote
  #2 (permalink)  
Old 05-04-2006
Giuseppe Maxia
 
Posts: n/a
Default Re: Searchin for multiple similar entries.

Simon wrote:
> Hi,
>
> I am looking for double entry in my database.
> So that, for example, if the name bob was listed more than once I would get
> the name and the number of times it is listed.
>
> What select statement should I use to list all the similar entries?
>
> Regards,
>
> Simon
>
>


Here's one way to get all duplicates from the "name" column:

SELECT
name, count(*) as how_many
FROM
tablename
GROUP BY
name
HAVING
how_many > 1

ciao
gmax

--
_ _ _ _
(_|| | |(_|>< The Data Charmer
_|
http://datacharmer.blogspot.com/
Reply With Quote
  #3 (permalink)  
Old 05-04-2006
strawberry
 
Posts: n/a
Default Re: Searchin for multiple similar entries.

or you could try something like this:

SELECT count(*),f_name,GROUP_CONCAT(f_name,' ',l_name) FROM contacts
WHERE f_name RLIKE '[b,r]ob' GROUP BY f_name;

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:18 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0