Solved

Compare two Crosstabs

Posted on 2004-08-19
2
232 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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

713 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