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  

Compare fields in query



 
 
Thread Tools Display Modes
  #1  
Old September 29th, 2004, 08:42 PM
ds
external usenet poster
 
Posts: n/a
Default Compare fields in query

SQL dummy needs help. What's the syntax for a query that
will output records where tblParts.TgtThick does not equal
tblParts.ActThick. In this case its a number field but I
see where I might need to compare text fields as well.
Thanks for the help.
  #2  
Old September 29th, 2004, 09:19 PM
LeAnne
external usenet poster
 
Posts: n/a
Default

Hi ds,

What you have to do is put tblParts into the query *twice* and join
tbpParts.TgtThick to tblParts.ActThick. The syntax should look something
like:

SELECT DISTINCTROW tblParts.*
FROM tblParts LEFT JOIN [tblParts_1] ON tblParts.TgtThick =
[tblParts_1].ActThick
WHERE ((([tblParts_1].ActThick) Is Null));

hth,

LeAnne


ds wrote:

SQL dummy needs help. What's the syntax for a query that
will output records where tblParts.TgtThick does not equal
tblParts.ActThick. In this case its a number field but I
see where I might need to compare text fields as well.
Thanks for the help.

  #3  
Old September 30th, 2004, 01:17 AM
John Spencer (MVP)
external usenet poster
 
Posts: n/a
Default

Seems like an awfully simple query.

SELECT TblParts.*
FROM TblParts
WHERE TblParts.tgtThick tblParts.ActThick

So the questions that arise a
Is this homework?
Is there more to the problem?

ds wrote:

SQL dummy needs help. What's the syntax for a query that
will output records where tblParts.TgtThick does not equal
tblParts.ActThick. In this case its a number field but I
see where I might need to compare text fields as well.
Thanks for the help.

  #4  
Old September 30th, 2004, 06:12 PM
ds
external usenet poster
 
Posts: n/a
Default

Yes, in the case of my text field an expression is being
used to concatenante fields from a different table:
SELECT tblMfg.SampleID, CombineChildRecords
("qryComposition","MaterialType","PartID",[PartID],",") AS
Composition
FROM tblMfg
then I want WHERE Composition tblMfg.CComposition
but I get prompted for Composition.

-----Original Message-----
Seems like an awfully simple query.

SELECT TblParts.*
FROM TblParts
WHERE TblParts.tgtThick tblParts.ActThick

So the questions that arise a
Is this homework?
Is there more to the problem?

ds wrote:

SQL dummy needs help. What's the syntax for a query that
will output records where tblParts.TgtThick does not

equal
tblParts.ActThick. In this case its a number field but I
see where I might need to compare text fields as well.
Thanks for the help.

.

  #5  
Old October 1st, 2004, 12:00 AM
John Spencer (MVP)
external usenet poster
 
Posts: n/a
Default

AHH!

Then you will need to re-calculate the value in the where clause. I _believe_
that Access won't allow you to use the alias for the field in the where clause.


SELECT tblMfg.SampleID, CombineChildRecords
("qryComposition","MaterialType","PartID",[PartID],",") AS
Composition
FROM tblMfg
WHERE
CombineChildRecords("qryComposition","MaterialType ","PartID",[PartID],",") tblMfg.CComposition

ds wrote:

Yes, in the case of my text field an expression is being
used to concatenante fields from a different table:
SELECT tblMfg.SampleID, CombineChildRecords
("qryComposition","MaterialType","PartID",[PartID],",") AS
Composition
FROM tblMfg
then I want WHERE Composition tblMfg.CComposition
but I get prompted for Composition.

-----Original Message-----
Seems like an awfully simple query.

SELECT TblParts.*
FROM TblParts
WHERE TblParts.tgtThick tblParts.ActThick

So the questions that arise a
Is this homework?
Is there more to the problem?

ds wrote:

SQL dummy needs help. What's the syntax for a query that
will output records where tblParts.TgtThick does not

equal
tblParts.ActThick. In this case its a number field but I
see where I might need to compare text fields as well.
Thanks for the help.

.

 




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
Unmatched Query: Memo Fields Bernie Running & Setting Up Queries 1 August 22nd, 2004 03:19 PM
query to create fields tony wong Running & Setting Up Queries 2 June 29th, 2004 10:36 PM
Fields not on form after ammending query Ronnie Using Forms 1 June 6th, 2004 01:11 AM
COMPARE THE TWO TABLES Stefanie General Discussion 0 June 4th, 2004 04:36 PM
surely a form with a ListBox can be used in a query? 1.156 Running & Setting Up Queries 14 June 2nd, 2004 04:54 PM


All times are GMT +1. The time now is 01:31 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.