A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
JDBC and Relational Databases
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
What are you going to eat for dinner today?
Is any Chinese here ?
Feasting on Asphalt
Is India a tough place to work for meat eaters?
Best eating joint in mumbai?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015