Consecutive dates

  • Thread starter AccessUser777 via AccessMonster.com
  • Start date
A

AccessUser777 via AccessMonster.com

Hi all,
Was wondering if I could get some help/insight/direction on how to tackle an
issue. I have a table that contains employee info along with dates that the
employee was absent. What I want to do is query this table to get all the
dates where an employee is absent consecutively and only apply one day of
chargeable hours.
For Example:
employeeID DateAbsent ChargeableHrs
ABC123 01/05/2010 8
ABC123 01/06/2010 8
ABC123 01/07/2010 8
ABC123 01/08/2010 8
ABC123 01/25/2010 8
ABC123 01/30/2010 8
ABC123 02/17/2010 8
ABC123 02/18/2010 8
ABC123 02/28/2010 8

For Jan/2010 employee ABC123 would only have 24 hours charged against him vs
64 and in Feb/2010 the same employee would have 8 vs 16 chargeable hrs.

Any idea on how to accomplish this or if it is even feasible? ANY insight is
appreciated. Thanks.
 
K

KARL DEWEY

For Jan/2010 employee ABC123 would only have 24 hours charged against him
vs 64 and in Feb/2010 the same employee would have 8 vs 16 chargeable hrs.
Should not that read ---
For Jan/2010 employee ABC123 would only have 24 hours charged against him vs
32 and in Feb/2010 the same employee would have 8 vs 24 chargeable hrs.

If I inderstand you want to charge hours that are a sequencial date set,
omitting the first day.

This will only list those days that are sequential beyond the first day --
SELECT AccessUser777.employeeID, AccessUser777_1.DateAbsent,
AccessUser777.ChargeableHrs
FROM AccessUser777 INNER JOIN AccessUser777 AS AccessUser777_1 ON
AccessUser777.employeeID = AccessUser777_1.employeeID
WHERE (((AccessUser777_1.DateAbsent)=[AccessUser777].[DateAbsent]+1));
 
A

AccessUser777 via AccessMonster.com

Karl,
You are correct on the calculations...sorry.
Thank you for your insight.

KARL said:
vs 64 and in Feb/2010 the same employee would have 8 vs 16 chargeable hrs.
Should not that read ---
For Jan/2010 employee ABC123 would only have 24 hours charged against him vs
32 and in Feb/2010 the same employee would have 8 vs 24 chargeable hrs.

If I inderstand you want to charge hours that are a sequencial date set,
omitting the first day.

This will only list those days that are sequential beyond the first day --
SELECT AccessUser777.employeeID, AccessUser777_1.DateAbsent,
AccessUser777.ChargeableHrs
FROM AccessUser777 INNER JOIN AccessUser777 AS AccessUser777_1 ON
AccessUser777.employeeID = AccessUser777_1.employeeID
WHERE (((AccessUser777_1.DateAbsent)=[AccessUser777].[DateAbsent]+1));
Hi all,
Was wondering if I could get some help/insight/direction on how to tackle an
[quoted text clipped - 19 lines]
Any idea on how to accomplish this or if it is even feasible? ANY insight is
appreciated. Thanks.
 
A

AccessUser777 via AccessMonster.com

Karl,
You are correct on the calculations...sorry.
Thank you for your insight.

KARL said:
vs 64 and in Feb/2010 the same employee would have 8 vs 16 chargeable hrs.
Should not that read ---
For Jan/2010 employee ABC123 would only have 24 hours charged against him vs
32 and in Feb/2010 the same employee would have 8 vs 24 chargeable hrs.

If I inderstand you want to charge hours that are a sequencial date set,
omitting the first day.

This will only list those days that are sequential beyond the first day --
SELECT AccessUser777.employeeID, AccessUser777_1.DateAbsent,
AccessUser777.ChargeableHrs
FROM AccessUser777 INNER JOIN AccessUser777 AS AccessUser777_1 ON
AccessUser777.employeeID = AccessUser777_1.employeeID
WHERE (((AccessUser777_1.DateAbsent)=[AccessUser777].[DateAbsent]+1));
Hi all,
Was wondering if I could get some help/insight/direction on how to tackle an
[quoted text clipped - 19 lines]
Any idea on how to accomplish this or if it is even feasible? ANY insight is
appreciated. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top