conditional criteria? (in a query statement) (1 Viewer)

Xx_TownDawg_xX

Registered User.
Local time
Today, 14:32
Joined
Jan 16, 2009
Messages
78
I'm not sure if you can do this or not?.. In essence a conditional criteria.

There are three types of audits: QA, QC and Int (Internal).

On the report, my boss wants to see all of the audit findings (including UAI, "use as-is") IF the AuditType - "QA", but does not want them included IF the AuditType is "QC" or "Int"

Can anyone suggest a WHERE statement that might work?

IF AuditType="QA" THEN (no additional condition)

ELSIF AuditType="QC" or "Int" THEN (filter OUT) DispType<>"UAI"

How do you do that in a query statement?
 

HiTechCoach

Well-known member
Local time
Today, 14:32
Joined
Mar 6, 2006
Messages
4,357
I'm not sure if you can do this or not?.. In essence a conditional criteria.

There are three types of audits: QA, QC and Int (Internal).

On the report, my boss wants to see all of the audit findings (including UAI, "use as-is") IF the AuditType - "QA", but does not want them included IF the AuditType is "QC" or "Int"

Can anyone suggest a WHERE statement that might work?

IF AuditType="QA" THEN (no additional condition)

ELSIF AuditType="QC" or "Int" THEN (filter OUT) DispType<>"UAI"

How do you do that in a query statement?

If you will use the Query Designer, it will make it easier.

On separate rows of the criteria, you put the option for each AuditType.


The SQL would look something like:

Code:
WHERE 
     ( AuditType="QA" )
  Or
    ( AuditType="QC" And DispType <>"UAI" )
  Or
    ( AuditType= "Int" And DispType <>"UAI" )
 

Xx_TownDawg_xX

Registered User.
Local time
Today, 14:32
Joined
Jan 16, 2009
Messages
78
I was just trying that out.. :).. It was sOoo much easier than I thought it would be.

WHERE (((rptDataEntry.Defect_ID)<>99) AND ((rptDataEntry.Dispo_ID)<>"UAI") AND ((rptDataEntry.[RSK])<>"1")) OR (((rptDataEntry.Defect_ID)<>99) AND ((rptDataEntry.[RSK])="1"))

Thank you sir.
 

HiTechCoach

Well-known member
Local time
Today, 14:32
Joined
Mar 6, 2006
Messages
4,357
I was just trying that out.. :).. It was sOoo much easier than I thought it would be.

WHERE (((rptDataEntry.Defect_ID)<>99) AND ((rptDataEntry.Dispo_ID)<>"UAI") AND ((rptDataEntry.[RSK])<>"1")) OR (((rptDataEntry.Defect_ID)<>99) AND ((rptDataEntry.[RSK])="1"))

Thank you sir.

You're welcome!

Glad I could assist.
 

Users who are viewing this thread

Top Bottom