Help on avoiding dupplicates (need distinct ID fields)

HerrSober

New Member
Joined
Aug 30, 2013
Messages
40
Hi all,

Due to a corrupt worker_ID table which I don't have write rights to, I get cartesian product on my query table below:

Code:
workhours_id    Date    Amount    worker_ID Productive
27567    05.07.2014    8,78    sein01    TRUE
27567    05.07.2014    8,78    sein01    FALSE
27568    05.07.2014    8,35    smith01    TRUE
27568    05.07.2014    8,35    smith01    FALSE
27569    05.07.2014    6,80    john01    FALSE

I'll therefore need your help to do a workaround:

If the field Productive is both FALSE and TRUE then I want it to return TRUE only like this:

Code:
workhours_id    Date    Amount    worker_ID Productive
27567    05.07.2014    8,78    sein01    TRUE
27568    05.07.2014    8,35    smith01    TRUE
27569    05.07.2014    6,80    john01    FALSE

Anyone have any ideas on how I could write a query for this?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Back up your tables before experimenting!!
I would try creating a select query using only the worker id field. Add it a second time to the grid, change the query to a totals query, use Count on that second field and put >1 as criteria. Create another query with your table and this query linked by worker id. Use the true/false field in this query and set the criteria to True. I'm thinking the first query will return only records where the worker id is duplicated and the second will only return records where the worker id has True in the record. You could make this an append query if you're trying to move these records into another table to clean things up.
BTW, just because you have duplicates doesn't make the results a Cartesian product. As far as I know, it happens when you include two or more tables and don't link any fields between at least one pair.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,028
Members
448,940
Latest member
mdusw

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