[nycphp-talk] OT - MySQL select question
Rob Marscher
rmarscher at beaffinitive.com
Thu Dec 7 10:34:16 EST 2006
I'm pretty sure the subquery is redundant... I think this will work...
SELECT * FROM table_name GROUP BY field_name HAVING COUNT(*) > 1
Andy Dirnberger wrote:
> SELECT * FROM table_name WHERE field_name IN (SELECT field_name FROM
> table_name GROUP BY field_name HAVING COUNT(*) > 1)
>
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
> Behalf Of Aaron Fischer
> Sent: Thursday, December 07, 2006 10:10 AM
> To: NYPHP Talk
> Subject: [nycphp-talk] OT - MySQL select question
>
> Greetings,
>
> I'm not sure how to do the following, any tips?
>
> I have a column in a MySQL table that contains varchars. I would like
> to select all records where there are instances of more than one record
> for any given varchar.
>
> So in plain language, the SQL statement would look something like:
>
> select * from table where the occurence of each unique varchar in column
> A is greater than one.
>
> Thoughts? Thanks!
>
> -Aaron
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
More information about the talk
mailing list