This worked for me.
Code:
SELECT DINER
FROM foodorders
GROUP BY ODATE, RESTRAUNT, DINER, FOOD
HAVING COUNT(DINER)>1;
Result(s)-------------- 2 rows --------------------
CHALIE
DAHLIA
Edit: Alternatively if you supplied an AUTO INCREMENTAL PK you could GROUP BY everything except for the PK then do a NOT EXISTS / maxwise / NOT IN to see which records were eliminated during the grouping. Either way seems fine. It would look something like this.
Code:
SELECT foodorders.DINER
FROM foodorders
WHERE idfoodorders NOT IN (
SELECT idfoodorders
FROM foodorders
GROUP BY DINER, RESTRAUNT, ODATE, FOOD
);
Result(s)-------------- 2 rows --------------------
DINER
--------
CHALIE
DAHLIA
Better yet:
Code:
SELECT foodorders.DINER
FROM foodorders
LEFT JOIN (
SELECT foodorders.idfoodorders
FROM foodorders
GROUP BY DINER, RESTRAUNT, ODATE, FOOD
) as mwise
ON mwise.idfoodorders = foodorders.idfoodorders
WHERE mwise.idfoodorders IS NULL;
Result(s)-------------- 2 rows --------------------
DINER
--------
CHALIE
DAHLIA
Unfortunately they were all so fast that I can't really say for sure which one is fastest... I would think the first one is fastest.
Cheers
Bookmarks