Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Compare two Crosstabs

Posted on 2004-08-19
2
Medium Priority
?
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
Eric Flamm earned 1000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

715 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