A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
SQL Select Help
Joined: Aug 20, 2007
Aug 28, 2007 04:48:00
Hoping someone can help me out here . . .
I have a table that contains a number of records. It has two fields, "Starter" and "Main Course". Typical data would look like this. . .
etc . . .
I need to try and select all similar pairs that occur in the table more than once. For example, in the above table, I would be looking to select Soup and Beef and Salad and Pork as they occur more than twice.
Joined: Aug 16, 2005
Aug 28, 2007 08:12:00
Off the top of my head, something like:
SELECT Starter, Main, Count(Main)AS cnt FROM my_table WHERE cnt>1;
should get you a list of any duplicates.
[ August 29, 2007: Message edited by: Chad Clites ]
subject: SQL Select Help
Feasting on Asphalt
What are you going to eat for dinner today?
Is any Chinese here ?
Best eating joint in mumbai?
Is India a tough place to work for meat eaters?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014