Query for Multiple Records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to query for the following records:

FFA-QSC6010 and SURF-QSC6010

I have tried a number of ways but it continues to bring up all records. Any
suggestions? I would like to just search for any record containing "6010"
 
Would help if you post the SQL you tried

In any case try:

Select * From TableName Where FieldName Like "*6010*"
 
Here is the code. It still did not work.

SELECT CRData.State, CRData.Type, CRData.Target, CRData.Severity, CRData.Pr,
CRData.Rel
FROM CRData
WHERE (((CRData.State)<>"BUILT") AND ((CRData.Type)="Bug") AND
((CRData.Target) Like "*6010*") AND ((CRData.Rel)="3.1P1")) OR
(((CRData.Rel)="3.1P2")) OR (((CRData.Rel)="3.2"))
ORDER BY CRData.Target;
 
It's funny. After I take out the REL number it works. Don't know why the
REL number is causing trouble.
 
Try

SELECT CRData.State, CRData.Type, CRData.Target, CRData.Severity,
CRData.Pr,
CRData.Rel
FROM CRData
WHERE CRData.State)<>"BUILT"
AND CRData.Type="Bug" AND
CRData.Target Like "*6010*" AND
CRData.Rel In *"3.1P1","3.1P2",="3.2")
ORDER BY CRData.Target;


The reason that you were getting other records is that your criteria got
records where
-- Rel was equal to 3.1PD or 3.2,

-- Plus records where State was not equal to "Built" and Type was Bug
and rel was 3.1P1.

You could change the criteria to
SELECT CRData.State, CRData.Type, CRData.Target, CRData.Severity,
CRData.Pr,
CRData.Rel
FROM CRData
WHERE CRData.State)<>"BUILT"
AND CRData.Type="Bug"
AND CRData.Target Like "*6010*"
AND (CRData.Rel="3.1P1"
OR CRData.Rel="3.1P2
OR CRData.Rel="3.2")
ORDER BY CRData.Target;


'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Back
Top