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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Incidences and Total Days

Status
Not open for further replies.

NOPOPNOSTYLE

IS-IT--Management
Apr 9, 2002
38
GB
I've really been Scratching my head with this one. I've got a table structured thus.. Field 1; Attending (Text) with either a "Yes" or "No", Field 2; Date (Short Date)in accending order; Field 3 Exception (Text)only entry would be "Sick" otherwise field will be Null. The Dates are the days that people attend, therefore the next record down is not always 1 day later than the previous record. I would like to create a query that would count how many consecutive working days were taken off sick, count that as 1 incidence and return the total number of days taken for that incidence. However there will be multiple incidences and and I Would like one result for the all data looked at.

Many Thanks

Lord Exell
 
From the number of people who have marked this without replying, this must be a real poser. Just to keep the thread alive, let me offer the following:

You want (I think) the output to look something like:

IncidentNumber DurationDays
1 3
2 1
3 6
. .
. .

Right?


And the days that people aren't supposed to attend aren't in the record? That's probably a good thing; that way we don't have to subtract weekends or holidays or "by"s or whatever.

It wouldn't be terribly difficult in VB, but I sure don't have enough SQL to make it work. Anyone else out there up for it?

Ron
 
I don`t think SQL is an option with this on is it? VB should be easy enough to do. Does this table link into another with individual names details etc or is a single entity?

Ian
 

Ok I've got some time to kill I'll have a play around and see what emerges.

regards

jo
 
Paron

You have hit the nail on the head, this is exactly what I need result wise.

Taff07, I do have a Names table which could easily relate to this query.

Many thanks for your time on this, I hope you can come up with the solution.

Lord Exell
 
Well, it's been a while; I am inclined to think you're stuck with using VB. If Jo couldn't do it in this amount of time, it's a really tricky one for SQL -- probably impossible.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top