PC Review


Reply
Thread Tools Rate Thread

Displaying un-matched records in query/crosstab query

 
 
lizo.consulting@gmail.com
Guest
Posts: n/a
 
      26th Jan 2009
I'm working on a project that will facilitate comparing a large amount
of historical data stored in "horizontal" format to new data that is
being collected in "vertical" format. I need to turn the "vertical"
data "horizontal" in order to do data analysis and comparison.

The new data consists of two tables:

lst_antigens: list of possible agents that could be used in a
laboratory test

antigenName
Antigen1
Antigen2
Antigen3
Antigen4
Antigen5
Antigen6
Antigen7
etc....

tbl_TestResults: contains a variable set of test results by antigen,
depending on which the scientist has chosen to use for the particular
test.

trID TestID Antigen TestResult

1 57 antigen1 2.7
2 57 antigen3 0
3 57 Antigen4 27
4 57 Antigen7 35
5 58 Antigen1 15
6 58 Antigen2 2
7 58 Antigen4 3
8 58 Antigen 7 8


I need to turn data in tbl_TestResults from vertical to horizontal (by
TestID) in order to analyze the results against some historical data
(may even need to write additional rows to the table containing the
historical data). I've got a working crosstab query that successfully
turns the data in tbl_TestResults from vertical to horizontal by test
ID:

testID Antigen1 Antigen2 Antigen3 Antigen4 Antigen7
57 2.7 0 27 35
58 15 2 3
8

*However*, I need for the crosstab query to include one column for
each of the antigens located in the lst_Antigens, *even if* there are
no corresponding records in the tbl_testResults. For example:

testID Antigen1 Angigen2 Antigen3 Antigen4 Antigen 5
Antigen6 Antigen7
57 2.7 0
27 35
58 15 2
3 8

Note: even though antigen 5 and Antigen 6 have no results, I would
like to have them show in the crosstab.

The crosstab is based on a select query that joins lst_antigens to
tbl_TestResults (includes all antigens and the results in
tbl_TestResults that match), but I cannot get this select query to
include antigens with no test results (e.g. Antigen5 and Antigen6 are
eliminated).

Any suggestions on building a query that would return a one full list
of test results by Antigen for each Test ID, such as:

trD TestID Antigen TestResult

1 57 antigen1 2.7
57 antigen2
2 57 antigen3 0
3 57 antigen4 27
57 antigen5
57 antigen6
4 57 antigen7 35
5 58 antigen1 15
6 58 antigen2 2
58 antigen3
7 58 antigen4 3
58 antigen5
58 antigen6
8 58 antigen7 8


Thanks for your assistance,

Liz O'Donoghue
University of Washington
(E-Mail Removed)
 
Reply With Quote
 
 
 
 
lizo.consulting@gmail.com
Guest
Posts: n/a
 
      26th Jan 2009
Noticed my table formatting for some of my posting got altered by my
browser.

The new data consists of two tables:

lst_antigens: list of possible agents that could be used in a
laboratory test

antigenName
Antigen1
Antigen2
Antigen3
Antigen4
Antigen5
Antigen6
Antigen7
etc....

tbl_TestResults: contains a variable set of test results by antigen,
depending on which the scientist has chosen to use for the particular
test.

trID TestID Antigen TestResult

1 57 antigen1 2.7
2 57 antigen3 0
3 57 Antigen4 27
4 57 Antigen7 35
5 58 Antigen1 15
6 58 Antigen2 2
7 58 Antigen4 3
8 58 Antigen 7 8

J need to create a select query that joins lst_antigens to
tbl_TestResults and includes antigens with no test results (e.g.
Antigen5 and Antigen6 are
eliminated).

Any suggestions on building a query that would return a one full list
of test results by Antigen for each Test ID, such as:

trD TestID Antigen TestResult

1 57 antigen1 2.7
57 antigen2
2 57 antigen3 0
3 57 antigen4 27
57 antigen5
57 antigen6
4 57 antigen7 35
5 58 antigen1 15
6 58 antigen2 2
58 antigen3
7 58 antigen4 3
58 antigen5
58 antigen6
8 58 antigen7 8

Thanks for your assistance,

Liz
 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      26th Jan 2009
Not sure what kind of comparison you intend to do, but have you looked into
exporting the data as is into Excel, then using the Excel Transpose function
to swap vertical for horizontal? Spreadsheets generally offer more analytic
capabilities...

Regards

Jeff Boyce
Microsoft Office/Access MVP

<(E-Mail Removed)> wrote in message
news:ee3039a1-f706-41ef-bafe-(E-Mail Removed)...
> Noticed my table formatting for some of my posting got altered by my
> browser.
>
> The new data consists of two tables:
>
> lst_antigens: list of possible agents that could be used in a
> laboratory test
>
> antigenName
> Antigen1
> Antigen2
> Antigen3
> Antigen4
> Antigen5
> Antigen6
> Antigen7
> etc....
>
> tbl_TestResults: contains a variable set of test results by antigen,
> depending on which the scientist has chosen to use for the particular
> test.
>
> trID TestID Antigen TestResult
>
> 1 57 antigen1 2.7
> 2 57 antigen3 0
> 3 57 Antigen4 27
> 4 57 Antigen7 35
> 5 58 Antigen1 15
> 6 58 Antigen2 2
> 7 58 Antigen4 3
> 8 58 Antigen 7 8
>
> J need to create a select query that joins lst_antigens to
> tbl_TestResults and includes antigens with no test results (e.g.
> Antigen5 and Antigen6 are
> eliminated).
>
> Any suggestions on building a query that would return a one full list
> of test results by Antigen for each Test ID, such as:
>
> trD TestID Antigen TestResult
>
> 1 57 antigen1 2.7
> 57 antigen2
> 2 57 antigen3 0
> 3 57 antigen4 27
> 57 antigen5
> 57 antigen6
> 4 57 antigen7 35
> 5 58 antigen1 15
> 6 58 antigen2 2
> 58 antigen3
> 7 58 antigen4 3
> 58 antigen5
> 58 antigen6
> 8 58 antigen7 8
>
> Thanks for your assistance,
>
> Liz



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When Filtering Query - Query returns no records when there arer matching records D Witherspoon Microsoft Access Queries 2 13th Mar 2006 05:07 PM
Nslookup query for NS records returns all of the NS records, but not all of the Host records Bob Microsoft Windows 2000 Networking 1 8th Nov 2004 08:03 PM
Nslookup query for NS records returns all of the NS records, but not all of the Host records Bob Microsoft Windows 2000 DNS 2 7th Nov 2004 05:42 AM
displaying all the duplicate records in a duplicate query Paul James Microsoft Access Queries 6 15th Jul 2004 09:28 AM
RE: Query use in form displaying records Eric Butts Microsoft Access Queries 0 9th Jul 2003 06:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:48 PM.