[drupal-devel] couple of SQL questions
gordon at heydon.com.au
Mon Oct 10 23:10:57 UTC 2005
On Mon, 2005-10-10 at 10:05 -0400, James Walker wrote:
> On 10-Oct-05, at 9:42 AM, Gordon Heydon wrote:
> > Hi,
> > I have a couple of issues that I have been playing with for a project
> > and can't quite get my head around it from a SQL POV.
> > Is it possible to list all the rows in a table where one column has
> > more
> > than one occurrence of the same value.
> > In this can I am storing the ip address of some submitted data, and I
> > need to check to see if they have submitted more than 1 row. I don't
> > care about the ones with a single occurance, but I need to know about
> > the ones that appear more that one.
> I think you're looking for something like:
> SELECT foo, bar, count(baz) as num FROM table GROUP BY foo, bar
> HAVING num > 1;
Thanks, this will return the consolidated list of results, but is there
a way to still display the individual details.
I think I may need to create a new page that will help identify dups.
More information about the drupal-devel