SQL help omitting records

Sorry, I was testing your sample and then got pulled away for another project. That being said, Yes you did indicate the draw back being it would only work with 2. I do however need it to work if there is only 1 or 2.
 
Sorry, I was testing your sample and then got pulled away for another project. That being said, Yes you did indicate the draw back being it would only work with 2. I do however need it to work if there is only 1 or 2.
Hi. Did you see my last post? I asked which records you want the query to return if only 1 withdrawal is present.

Here's a sample query that will return the "after withdrawal" records. Just to show you it's possible.

Code:
SELECT Sample.*
FROM Sample
WHERE ((DCount("*","Sample","Customer='General Withdrawal'")>1 And ([Sample].[Date]+CDate([Sample].[Time]))>DMin("Date + CDate([Time])","Sample","Customer='General Withdrawal'") And ([Sample].[Date]+CDate([Sample].[Time]))<DMax("Date + CDate([Time])","Sample","Customer='General Withdrawal'")))
OR ((DCount("*","Sample","Customer='General Withdrawal'")=1 And ([Sample].[Date]+CDate([Sample].[Time]))>DLookup("Date + CDate([Time])","Sample","Customer='General Withdrawal'")));
 
And in addition to theDBGuy's questions, are the withdrawals always happening in the start and\or end dates? If that is the case it would be easier to identify the right boundaries.

Cheers,
 

Users who are viewing this thread

Back
Top Bottom