Solved

Compare two Crosstabs

Posted on 2004-08-19
2
199 Views
Last Modified: 2008-01-16
I need to do a field by field comparison on the result of a crosstab query and a table.

Table 1 contains a list of datapoints that I've collected and for each ID if the data was collected i've denoted it w/ a 1.
Table 2 contains a list of datapoints that has been processed and in table 2 processed data is also denoted w/ a 1.

Table 3 needs to contain hits (a 1)  for each datapoint that has been collected but has not been processed in essence creating a to do list
for each ID by datapoint

Sample Data:

table 1
ID  dp1  dp2  dp3  dp4  dp5
1   0      1      0      1     1
2   0      0      1      0     1
3   1      0      1      1     1
4   0      1      1      1     0
5   1      1      1      0     0  

table 2
ID  dp1  dp2  dp3  dp4  dp5
1   0      1      0      0     0
2   0      0      1      0     1
3   1      0      1      0     1
4   0      0      0      0     0
5   0      1      0      0     0

table 3
ID  dp1  dp2  dp3  dp4  dp5
1   0      0      0      1     1
2   0      0      0      0     0
3   0      0      0      1     0
4   0      1      1      1     0
5   1      0      1      0     0

0
Comment
Question by:swingler
2 Comments
 
LVL 8

Accepted Solution

by:
Eric Flamm earned 250 total points
ID: 11845164
Sounds like a logical "and" problem - bitwise arithmetic and all that. However, in Access, it's also pretty easy, I think.

I don't know if you need a general or specific solution  - here'a specific one:

create a query as follows:

select c.ID, c.dp1-p.dp1 as ToDoDp1, c.dp2-p.dp2 as ToDoDp2, c.dp3-p.dp3 as ToDoDp3, c.dp4-p.dp4 as ToDoDp4,
c.dp5-p.dp5 as ToDoDp5 from
Table1 c INNER JOIN Table2 p where c.ID=p.ID

note that the output field names are all prefaced with ToDo - that's just a field name, not a table alias like c and p.

I just used arithmetic - you could actually do this with Boolean datatypes (True/False) and the Nand (Not and) operator.

-ef
0
 

Author Comment

by:swingler
ID: 11852979
perfect!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now