Compare fields in query

  • Thread starter Thread starter ds
  • Start date Start date
D

ds

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.
 
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
 
Seems like an awfully simple query.

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

So the questions that arise are:
Is this homework?
Is there more to the problem?
 
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
 
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
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
-----Original Message-----
Seems like an awfully simple query.

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

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

.
 
Back
Top