Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 10th, 2008, 01:48 PM
guymun guymun is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 8 guymun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 9 sec
Reputation Power: 0
Urgent -query help log in log out sum

I have two tables u_hist and persl_hist
each table has columns that I need, to get the information that I need. (basically one table has the event status (I only need the events ln and lo which are log out log in events and thier corresponding times. the other has the employee ids, I need to figure out how to loop through the tables for a certain employee during a certain date range, and calculate the hours worked by taking a log on time and subtracting it from a log off time then adding the results of each day. the problem is that there are not an equal amount of log off times to log on times.
my sql goes like this
SQL11 = SELECT U_hist.ts, U_hist.unit_status
FROM persl_hist, u_hist
WHERE U_hist.ts BETWEEN '20070701000000pd' AND '20070801000000pd'
AND U_hist.unit_status='Logon' Or U_hist.unit_status='logoff' AND U_hist.uid=persl_hist.uid
AND persl_hist.empid =30973
A lot I know but this gets the log off log on datetimestamp
for a particular employee,, but I cant seem to loop through it taking the first log on and the next log off to do the math to ge t the hours worked. I run into the problem where there are extra log on times or actually the employee would forget to log off. I need to skip those some how..PLEASE HELP

Reply With Quote

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Urgent -query help log in log out sum


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway