Re: Union query and exclusion of data
- From: "Gary Walter" <gary@xxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 08:43:18 -0600
Hi Syed,
I am sure you are explaining in mathematically accurate
terms, but I regretably must be in some fog today...
Is there a chance you could give some example data
for A.x and B.x, then result from that data that you want
including which table final value comes from?
sorry...my old reliable computer went down
Friday and am using old noisy (jet-engine) server
while I try to revive old faithful -- so noise and frustrations
are getting in way of understanding...(I'm sure its not
old brain..hah)
gary
"Syed Zeeshan Haider" wrote:
Thank you for your response. This query included data only from B when itgiven
was shared by both tables. I am trying to exclude and include A in the
case.the
Thanks again for your time!
"Gary Walter" <gary@xxxxxxxxxxx> wrote in message
news:exRB5AekIHA.4244@xxxxxxxxxxxxxxxxxxxxxxx
"Syed Zeeshan Haider"wrot:
I am usin Access 2003 Pro and trying to create a rather complex unionquery
but don't seem to implement conditions.also
Let's say I have two tables called A and B. A has column called x and B
has a column called x. I am trying to join these two columns into onecolumn
with following conditions:table
If e is a member of both A and B then the query should include e from
A only (because the second column calculates a value which depends on
choice of table for picking e). I have tried all INNER JOIN, LEFT JOIN
and
RIGHT JOIN but none of them have worked so far.
Here is an example of what I did:
select [A].[x]
FROM [A] INNER JOIN [B] ON [A].[x] = [B].[x]
where (([A].[x]) Is Not Null) and (([A].[x])<>([B].[x]))
UNION select [B].[x]
from [B];
Any ideas what am I doing wrong here?
Any help will be highly appreciated.
Thank you,
--
Syed Zeeshan Haider
Hi Syed,
It sure sounds like you want
(just threw in "FromTable" to verify)
SELECT
"A" As FromTable,
A.x As WantValue
FROM A
UNION
SELECT
"B",
B.x
FROM
B LEFT JOIN A
ON
B.x = A.x
WHERE
A.x IS NULL
ORDER BY
WantValue,
FromTable;
the first select gets all A.x...
the last select gets all of B
except where value of B.x in A.x...
good luck,
gary
.
- References:
- Union query and exclusion of data
- From: Syed Zeeshan Haider
- Re: Union query and exclusion of data
- From: Gary Walter
- Re: Union query and exclusion of data
- From: Syed Zeeshan Haider
- Union query and exclusion of data
- Prev by Date: Re: Union query and exclusion of data
- Next by Date: Query AND criteria
- Previous by thread: Re: Union query and exclusion of data
- Next by thread: Re: Union query and exclusion of data
- Index(es):
Relevant Pages
|
|