Cross Tab Query Help

clayt101

Board Regular
Joined
Nov 26, 2008
Messages
53
I have a large table that I can run a cross tab query on. My issue is that when I run the cross tab query, there are some duplicates. I can find them by doing using the count function when running the query. Unfortunately, there are 1014 rows out of 16,000+ rows that have a duplicate some where in the row (anywhere there is not a 1 using the count function). Can anyone think of a fast, easy way to get at these to examine them?

Right now, my best idea is to run the multiple times and compare them. I would run it once as a max function, and then as an average function. I could then compare the results. This would knock out the multiples where the value is the same (for example if the cell has the max value of 0 and the average value of 0, that would mean that all of the multiple values all have the value of 0). I would then have to go in manually and compare them.

Of course, this is a very large database with about 60 columns, so if I were to compare the average crosstab query and the max crosstab query, I might run out of memory.

I guess what I want to know is are there any easy ways to do this (like a tool) that might be built into microsoft access that my novice abilities do not know about?

Thanks
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
If you're saying the crosstab has 60 columns and the duplicate value can appear anywhere in those, I'm not sure the tutorial would be usable. Forgive the question, but have you examined the underlying select portion of the query to see if you can eliminate the duplicates by adjusting the usual suspects (inner vs outer joins, DISTINCT or DISTINCTROW predicates)? You might be able to tune a select query and eliminate duplicates before changing it to a crosstab. I'm assuming you are only using aggregate functions to spot duplicates, not that you need to perform an aggregate function with the query result, otherwise eliminating dupes from the underlying records would not make sense.
 
Upvote 0
I used excel to compare my average crosstab query and my max crosstab query. In excel, I deleted the duplicates. It left me with 31 rows where a max value was different than the average value. I need to keep all the unique ones...I can deal with 31 rows. Unfortunately, this only tells me that these 31 rows have at least 2 different values, it does not tell me how many. When I ran the count query, I remember seeing some with as many as 7.
 
Upvote 0
Take your crosstab query and use it as a recordset for a new query. In the new query, use a Distinct Row as your criteria in your SQL statement. See this link for how to do it.

https://support.office.com/en-sg/ar...edicates-24f2a47d-a803-4c7c-8e81-756fe298ce57

I will give that a shot after I get back from lunch. For the time being, I took a screenshot. What I really need is for this crosstab query to give me every result (even multiples I suppose).
Query.png
 
Upvote 0
I will give that a shot after I get back from lunch. For the time being, I took a screenshot. What I really need is for this crosstab query to give me every result (even multiples I suppose). Edit: Not Avg, Count, Sum, Etc...
Query.png
 
Upvote 0
I'm confused now. I have reread the original post. Some questions. Do you want to have a report/query that shows only the duplicates from the Crosstab Query.
 
Upvote 0
Problem is, a crosstab has to perform an aggregate function, no? Thus a crosstab is probably the wrong query type since in post #8 he said he wants all results, including multiples and no Count, Avg, Sum, etc. Sounds like a select query to me. If that's the case, I suggest ditching this thread as the title would be totally off base. Better to start over with a sample of what he has and a mockup of what he wants.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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