List:General Discussion« Previous MessageNext Message »
From:Peter Bradley Date:November 28 2006 6:43pm
Subject:Re: Simple doubt
View as plain text  
Ysgrifennodd ViSolve DB Team:
> Hi Renish,
>
> If you want to capture the entries which are entered more than once. 
> Here's the answer for it.
>
> mysql> select * from a;
> +--------+
> | b      |
> +--------+
> | pen    |
> | pencil |
> | rubber |
> | pen    |
> | paper  |
> | paper  |
> +--------+
> 6 rows in set (0.00 sec)
>
> mysql> select b from a group by b having count(b)>1;
> +-------+
> | b     |
> +-------+
> | paper |
> | pen   |
> +-------+
> 2 rows in set (0.00 sec)
>
> Hope this helps.
>
>
> Thanks,
> ViSolve DB Team.
Or (IIRC):

SELECT col_with_dupes, COUNT(col_with_dupes)
FROM table
GROUP BY col_with_dupes
HAVING COUNT(col_with_dupes) > 1


Peter

Thread
Simple doubtRenish28 Nov
  • Re: Simple doubtPeter Brawley28 Nov
  • Re: Simple doubtRenish28 Nov
    • Re: Simple doubtPeter Brawley28 Nov
  • Re: Simple doubtRenish28 Nov
  • Re: Simple doubtRenish28 Nov
    • Re: Simple doubtPeter Brawley28 Nov
  • Re: Simple doubtViSolve DB Team28 Nov
    • Re: Simple doubtPeter Bradley28 Nov
  • Re: Simple doubtRenish28 Nov
  • Re: Simple doubtRenish28 Nov
    • Re: Simple doubtPeter Brawley28 Nov