Solved

Compare two Crosstabs

Posted on 2004-08-19
2
224 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

789 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