A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

field not equal



 
 
Thread Tools Display Modes
  #1  
Old September 10th, 2005, 01:19 AM
neeraj
external usenet poster
 
Posts: n/a
Default field not equal

I am creating a query , say Query1 in which I am joining 2 queries, say
Query2 and Query3. I have joined them on a common field, say Field1. Values
of Field1 are such that the set of these values in Query2 is a subset of that
of Query1. I want Query1 to result only those records from Query1 where the
field values of Field1 are not equal, that is present in Query1 and not in
Query2.
  #2  
Old September 10th, 2005, 03:13 AM
Dale Fye
external usenet poster
 
Posts: n/a
Default

I think you have mixed up your references to Queries 1, 2, and 3.

If you want Query1 to return all the records from Query3 that do not have a
match in Field1 of Query2, then you can do it one of several ways. You
might want to test both methods to determine which is quickest in your
situation.

1. SELECT Query3.*
FROM Query3 LEFT JOIN Query2 ON Query3.Field1 = Query2.Field1
WHERE Query2.Field1 IS NULL

2. SELECT Query3.*
FROM Query 3
WHERE Query3.Field1 NOT IN (SELECT Query2.Field1 FROM Query2)

HTH
Dale

"neeraj" wrote in message
...
I am creating a query , say Query1 in which I am joining 2 queries, say
Query2 and Query3. I have joined them on a common field, say Field1.
Values
of Field1 are such that the set of these values in Query2 is a subset of
that
of Query1. I want Query1 to result only those records from Query1 where
the
field values of Field1 are not equal, that is present in Query1 and not in
Query2.



  #3  
Old September 12th, 2005, 07:29 PM
neeraj
external usenet poster
 
Posts: n/a
Default

Thanks, I did mix up the references but you understood it correctly. I used
the first method as it seemed easier to implement that in design grid of
Access query and it worked

"Dale Fye" wrote:

I think you have mixed up your references to Queries 1, 2, and 3.

If you want Query1 to return all the records from Query3 that do not have a
match in Field1 of Query2, then you can do it one of several ways. You
might want to test both methods to determine which is quickest in your
situation.

1. SELECT Query3.*
FROM Query3 LEFT JOIN Query2 ON Query3.Field1 = Query2.Field1
WHERE Query2.Field1 IS NULL

2. SELECT Query3.*
FROM Query 3
WHERE Query3.Field1 NOT IN (SELECT Query2.Field1 FROM Query2)

HTH
Dale

"neeraj" wrote in message
...
I am creating a query , say Query1 in which I am joining 2 queries, say
Query2 and Query3. I have joined them on a common field, say Field1.
Values
of Field1 are such that the set of these values in Query2 is a subset of
that
of Query1. I want Query1 to result only those records from Query1 where
the
field values of Field1 are not equal, that is present in Query1 and not in
Query2.




 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Memo Field Sam General Discussion 12 November 10th, 2005 09:16 PM
setting report field equal to form field T Best General Discussion 1 April 22nd, 2005 08:10 PM
Syntax needed to get needed reports Frank Lueder New Users 15 January 6th, 2005 08:39 AM
Setting a value of a field equal to another automatically in a form Chris General Discussion 7 November 15th, 2004 06:11 PM
Added text field to database. New entries not equal to "" ??? Noozer General Discussion 3 June 18th, 2004 01:33 AM


All times are GMT +1. The time now is 07:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.