Forums Register Login

SQL Select Help

+Pie Number of slices to send: Send
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. . .

Starter�Main
Soup, Beef
Soup, Chicken
Salad, Pork
Soup, Beef
Salad, Chicken
Soup, Beef
Salad, Pork
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.

Anyone help?
+Pie Number of slices to send: Send
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 ]
This tiny ad will self destruct in five seconds.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 781 times.
Similar Threads
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?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:58:04.