?Query that extracts all records entered over consecutive dates.

turtsmurt

New Member
Joined
Mar 4, 2010
Messages
45
Hello all,

**ROOKIE**

Have a simple query question. I have a table that records everytime an employee has attended a case (by case id#). I have created the below query to extract how many times an employee has attended a case with less than 2 days notice. I have all the criteria that I need here, however, I only want to extract the records that DO NOT include those cases where the employee attended the same case over consecutive dates.

I am not sure how to tell my query to look at the case number and employee number and exclude those cases that occurred over consecutive dates. I'm thinking that I will have to create a query for this and then use the below query.

Can anyone tell me how to create a query that just excludes all records that occur over consecutive dates?

Code:
SELECT tblNOTICE.OfficerPayroll, tblNOTICE.DCNumber, [CourtDate]-[DateSent] AS DIFF, [tblCOURTCODES-GROUPS].[COURT CODE DESCRIPTION], [tblCOURTCODES-GROUPS].[COURT LOCATION GROUP], tblNOTICE.CourtDate, tblNOTICE.DateSent, tblNOTICE.CancelFlag
FROM [tblCOURTCODES-GROUPS] INNER JOIN tblNOTICE ON [tblCOURTCODES-GROUPS].[CODE NUMBER] = tblNOTICE.AltCrm
WHERE ((([CourtDate]-[DateSent])<3) AND ((tblNOTICE.CourtDate) Not In ([CourtDate]+1)) AND ((tblNOTICE.CancelFlag) Is Null))
ORDER BY tblNOTICE.DCNumber, tblNOTICE.CourtDate;

Any help is always appreciated.

Christine :confused:
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top