Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old June 27th, 2008, 08:25 PM
murch.alexander@gmail.com
Guest
 
Posts: n/a
Default Should I use a temporary table?

Hi all,

I posted here last week with a simplified version of the following. I
didn't get many responses, so I'm going for the more detailed
explanation. Here's the problem:

We have a point-based program for our employee attendance policy. That
is, when an emp is late, they get 1/2 point, when they skip work, they
get 3 points, etc. At certain point thresholds, they receive different
discipline steps... for example, when they hit 6 points, they get a
verbal warning, at 9 points, they get a written warning, etc. The
catch is that when they go a certain amount of time (90 days) without
incident, one point is subtracted from their total. If they go 180
days, their point total is reset to zero. My ideal strategy is to
store only the data related to employee point accumulation. I want the
database, through a series of queries to tell me when the points
disappear.

So far, I've created a query that looks forward and finds the date of
each employee's next attendance issue. In other words, if an employee
has attendance problems on 5/1/06 and 11/31/06, the query will tell me
the time difference between the two. If there is no next issue, it
uses today's date. It then figures out how many days are between this
event and the next one to find out if one or all points can be
removed. I created two additional queries to tell me the exact dates
on which I can remove one point or all points.

Now I want to create a single query to give me a point history for
each employee over time. So, basically, I'll be showing the records
from the attendance issues table and inserting "on the fly" records of
point deductions as I go along. I've come close, but there are two
problems: I don't know how many points I can subtract when I want to
get rid of all points. I tried just using 100, but then the emp goes
into negative points, when in reality, they can only go as low as
zero. Also, when I try to add up a subtotal of points, I have to
recalculate the point subtotal which is a recursive nightmare.

Would temporary tables (to store the data from my calculation-heavy
queries) be a better solution? Any advice would be greatly
appreciated. Thanks!
  #2  
Old June 27th, 2008, 08:25 PM
paii, Ron
Guest
 
Posts: n/a
Default Re: Should I use a temporary table?


<murch.alexander@gmail.comwrote in message
news:5e7efac7-943e-4744-9a67-48ea3e822472@z72g2000hsb.googlegroups.com...
Quote:
Hi all,
>
I posted here last week with a simplified version of the following. I
didn't get many responses, so I'm going for the more detailed
explanation. Here's the problem:
>
We have a point-based program for our employee attendance policy. That
is, when an emp is late, they get 1/2 point, when they skip work, they
get 3 points, etc. At certain point thresholds, they receive different
discipline steps... for example, when they hit 6 points, they get a
verbal warning, at 9 points, they get a written warning, etc. The
catch is that when they go a certain amount of time (90 days) without
incident, one point is subtracted from their total. If they go 180
days, their point total is reset to zero. My ideal strategy is to
store only the data related to employee point accumulation. I want the
database, through a series of queries to tell me when the points
disappear.
>
So far, I've created a query that looks forward and finds the date of
each employee's next attendance issue. In other words, if an employee
has attendance problems on 5/1/06 and 11/31/06, the query will tell me
the time difference between the two. If there is no next issue, it
uses today's date. It then figures out how many days are between this
event and the next one to find out if one or all points can be
removed. I created two additional queries to tell me the exact dates
on which I can remove one point or all points.
>
Now I want to create a single query to give me a point history for
each employee over time. So, basically, I'll be showing the records
from the attendance issues table and inserting "on the fly" records of
point deductions as I go along. I've come close, but there are two
problems: I don't know how many points I can subtract when I want to
get rid of all points. I tried just using 100, but then the emp goes
into negative points, when in reality, they can only go as low as
zero. Also, when I try to add up a subtotal of points, I have to
recalculate the point subtotal which is a recursive nightmare.
>
Would temporary tables (to store the data from my calculation-heavy
queries) be a better solution? Any advice would be greatly
appreciated. Thanks!
Is each problem dated? If so sum all records more then 180 days old then
subtract 1 from each record where the sum of record's dated more then 90
days is greater then 1.


  #3  
Old June 27th, 2008, 08:25 PM
murch.alexander@gmail.com
Guest
 
Posts: n/a
Default Re: Should I use a temporary table?

On Jun 2, 11:10 am, "paii, Ron" <n...@no.comwrote:
Quote:
<murch.alexan...@gmail.comwrote in message
>
news:5e7efac7-943e-4744-9a67-48ea3e822472@z72g2000hsb.googlegroups.com...
>
>
>
Quote:
Hi all,
>
Quote:
I posted here last week with a simplified version of the following. I
didn't get many responses, so I'm going for the more detailed
explanation. Here's the problem:
>
Quote:
We have a point-based program for our employee attendance policy. That
is, when an emp is late, they get 1/2 point, when they skip work, they
get 3 points, etc. At certain point thresholds, they receive different
discipline steps... for example, when they hit 6 points, they get a
verbal warning, at 9 points, they get a written warning, etc. The
catch is that when they go a certain amount of time (90 days) without
incident, one point is subtracted from their total. If they go 180
days, their point total is reset to zero. My ideal strategy is to
store only the data related to employee point accumulation. I want the
database, through a series of queries to tell me when the points
disappear.
>
Quote:
So far, I've created a query that looks forward and finds the date of
each employee's next attendance issue. In other words, if an employee
has attendance problems on 5/1/06 and 11/31/06, the query will tell me
the time difference between the two. If there is no next issue, it
uses today's date. It then figures out how many days are between this
event and the next one to find out if one or all points can be
removed. I created two additional queries to tell me the exact dates
on which I can remove one point or all points.
>
Quote:
Now I want to create a single query to give me a point history for
each employee over time. So, basically, I'll be showing the records
from the attendance issues table and inserting "on the fly" records of
point deductions as I go along. I've come close, but there are two
problems: I don't know how many points I can subtract when I want to
get rid of all points. I tried just using 100, but then the emp goes
into negative points, when in reality, they can only go as low as
zero. Also, when I try to add up a subtotal of points, I have to
recalculate the point subtotal which is a recursive nightmare.
>
Quote:
Would temporary tables (to store the data from my calculation-heavy
queries) be a better solution? Any advice would be greatly
appreciated. Thanks!
>
Is each problem dated? If so sum all records more then 180 days old then
subtract 1 from each record where the sum of record's dated more then 90
days is greater then 1.
You just took elegant to a whole new level. This might very well do
the trick! The only remaining issue I have is that, sometimes, a
person might have only a half-point on his or her record. How can I
make only the 1/2 point go away without making the sum -1/2?
  #4  
Old June 27th, 2008, 08:25 PM
paii, Ron
Guest
 
Posts: n/a
Default Re: Should I use a temporary table?


<murch.alexander@gmail.comwrote in message
news:e5a826d7-6739-466c-9faa-fac6b33f0d4f@k37g2000hsf.googlegroups.com...
Quote:
On Jun 2, 11:10 am, "paii, Ron" <n...@no.comwrote:
Quote:
<murch.alexan...@gmail.comwrote in message
news:5e7efac7-943e-4744-9a67-48ea3e822472@z72g2000hsb.googlegroups.com...
Quote:
Quote:


Quote:
Hi all,
Quote:
I posted here last week with a simplified version of the following. I
didn't get many responses, so I'm going for the more detailed
explanation. Here's the problem:
Quote:
We have a point-based program for our employee attendance policy. That
is, when an emp is late, they get 1/2 point, when they skip work, they
get 3 points, etc. At certain point thresholds, they receive different
discipline steps... for example, when they hit 6 points, they get a
verbal warning, at 9 points, they get a written warning, etc. The
catch is that when they go a certain amount of time (90 days) without
incident, one point is subtracted from their total. If they go 180
days, their point total is reset to zero. My ideal strategy is to
store only the data related to employee point accumulation. I want the
database, through a series of queries to tell me when the points
disappear.
Quote:
So far, I've created a query that looks forward and finds the date of
each employee's next attendance issue. In other words, if an employee
has attendance problems on 5/1/06 and 11/31/06, the query will tell me
the time difference between the two. If there is no next issue, it
uses today's date. It then figures out how many days are between this
event and the next one to find out if one or all points can be
removed. I created two additional queries to tell me the exact dates
on which I can remove one point or all points.
Quote:
Now I want to create a single query to give me a point history for
each employee over time. So, basically, I'll be showing the records
from the attendance issues table and inserting "on the fly" records of
point deductions as I go along. I've come close, but there are two
problems: I don't know how many points I can subtract when I want to
get rid of all points. I tried just using 100, but then the emp goes
into negative points, when in reality, they can only go as low as
zero. Also, when I try to add up a subtotal of points, I have to
recalculate the point subtotal which is a recursive nightmare.
Quote:
Would temporary tables (to store the data from my calculation-heavy
queries) be a better solution? Any advice would be greatly
appreciated. Thanks!
Is each problem dated? If so sum all records more then 180 days old then
subtract 1 from each record where the sum of record's dated more then 90
days is greater then 1.
>
You just took elegant to a whole new level. This might very well do
the trick! The only remaining issue I have is that, sometimes, a
person might have only a half-point on his or her record. How can I
make only the 1/2 point go away without making the sum -1/2?
iif( sumLast90<1,sumLast90, 1)


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles