Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set WHERE statement based on two Criteria 2

Status
Not open for further replies.

debq

Technical User
Aug 7, 2008
50
US
I have a Query that SELECTS records based on a Percent. If the percent is Greater Than 40% then SELECT the record.

Now this criteria is changing to SELECT Records after 08/31/2012 that are Greater Than 30%. I need to continue to SELECT Records with Greater Than 40% prior to 08/31/2012 and then using the new criteria of 30% SELECT Records after 09/1/2012.

I have created a field titled {Action_Period] which assigns either a 4 for dates less than or equal to 08/31/2012 and a 5 to dates greater than 09/01/2012.

HOw can I set my Percent field to this selection criteria?

I tried the following WHERE Statement, but it is only returning records for period equal to 5. It is pulling the correct percents but is not showing me any records for period 4.
Code:
WHERE (((HEALTH_DOCA_SUMMARY_OF_CASES.Percent)>=0.395 And [Action_Period]<4)) OR (((HEALTH_DOCA_SUMMARY_OF_CASES.Percent)>=0.295 And [Action_Period]=5))

My complete QUERY SQL is
Code:
.Audit_Type AS Fup_audit, HEALTH_DOCA_AUDIT_REVIEWS.FUPAudit_Status, [Follow-Up Audits].Audit_MonthYear, [Follow-Up Audits].Action_Type AS [Follow-Up_Result], [Follow-Up Audits].Fup_close_audit, HEALTH_DOCA_ACTION_TYPES.Action_Type, CASEM_MA_ACTIVITIES.ACTIVITY_NAME, CASEM_MA_TRANSACTIONS.ACTIVITY_DATE, CASEM_MA_TRANSACTIONS.COMMENTS, HEALTH_DOCA_SUMMARY_OF_CASES.PERCENT, HEALTH_DOCA_SUMMARY_OF_CASES.ACTION_PERIOD INTO [tbl_temp_failed E and M audits]]


Any help or guidance on this code would be greatly appreciated.
 
WHERE (HEALTH_DOCA_SUMMARY_OF_CASES.Percent>=0.395 AND Action_Period<[!]=[/!]4) OR (HEALTH_DOCA_SUMMARY_OF_CASES.Percent>=0.295 AND Action_Period=5)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hi,
but is not showing me any records for period 4
Code:
WHERE 
(((HEALTH_DOCA_SUMMARY_OF_CASES.Percent)>=0.395 And [Action_Period][highlight][b]<[/b]4[/highlight])) OR
(((HEALTH_DOCA_SUMMARY_OF_CASES.Percent)>=0.295 And [Action_Period]=5))


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Ah Hah!!!! Perfect!!! Thanks for helping me so quickly... It always seems to be the little things that get me!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top