Access SQL Query - Compare & Identify 2 columns in same table

Nowherefast

New Member
Joined
May 18, 2009
Messages
23
Hello All

I am trying to compare and identify 2 columns within the same table to output which UPC's have more than 1 occurrence in UniqItem field

For example

UPC UniqItem
5555555555 333222
5555555555 333222
5555555555 333222
3333333333 000001
3333333333 000001
3333333333 000002
3333333333 000001

The query should result in

UPC UniqItem
3333333333 000001
3333333333 000001
3333333333 000002
3333333333 000001

I've been working on the following Query but nothing comes out

SELECT UPC, UniqItem
from [ItemTable]
group by UPC, UniqItem
having min(UniqItem) <> max(UniqItem);

What am I doing wrong?

Thank you
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try this:
Code:
SELECT UPC, UniqItem
FROM ItemTable
WHERE UPC In
(SELECT UPC
FROM ItemTable
GROUP BY UPC
HAVING Min(UniqItem) <> Max(UniqItem));
 
Upvote 0

Forum statistics

Threads
1,221,707
Messages
6,161,416
Members
451,705
Latest member
Priti_190

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top