[AccessD] Union Query quick question

Bobby Heid bheid at appdevgrp.com
Wed Dec 21 14:47:53 CST 2005


I think you will have to use subqueries to pull the data for the b and c
data with the main query getting the a data.

Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of O'Connor,
Patricia (OTDA)
Sent: Wednesday, December 21, 2005 3:32 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Union Query quick question


Thanks but That still produces 3 records.

Below is a better example

> Example:  A fills a, B fills b, C fills c.
>     
>    Select CaseNo, CArea, a1,a2,a3,b1,b2,b3,c1,c2,c3
>    from table1 
>    where x3 = "A"
> Union
>    Select CaseNo, CArea, a1,a2,a3,b1,b2,b3,c1,c2,c3
>    from table1 
>    where x3 = "B"
> Union
>    Select CaseNo, CArea, a1,a2,a3,b1,b2,b3,c1,c2,c3
>    from table1 
>    where x3 = "C"
> 
Right now I for each CASENO Carea I can get 1 to 3 records. Each record
for a Caseno, Carea would have a particular grouping filled and the
others null
     C1234,01,a1,a2,a3,  ,  ,  ,  ,  ,  ,
     C1234,01,  ,  ,  ,b1,b2,b3,
     C1234,01,  ,  ,  ,  ,  ,  ,c1,c2,c3,

I would like to have the output look like
     C1234,01,a1,a2,a3,b1,b2,b3,c1,c2,c3,


Thanks
**************************************************
* Patricia O'Connor
* Associate Computer Programmer Analyst
* OTDA - BDMA
* (W) mailto:Patricia.O'Connor at otda.state.ny.us
* (w) mailto:aa1160 at otda.state.ny.us
**************************************************
 

> 
--------------------------------------------------------
This e-mail, including any attachments, may be confidential, privileged or
otherwise legally protected. It is intended only for the addressee. If you
received this e-mail in error or from someone who was not authorized to send
it to you, do not disseminate, copy or otherwise use this e-mail or its
attachments.  Please notify the sender immediately by reply e-mail and
delete the e-mail from your system. 


-----Original Message-----

> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Heenan, Lambert
> Sent: Wednesday, December 21, 2005 02:46 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Union Query quick question
> 
> Select Distinct * from YourUnionQuery;
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list