hi, new user here.
i m developing an attendance system for my firm using vb.net to build the frontend and access 2007 as backend. here's my table structure-
table: logins
id
username
password
user category
table: log
id
name
machine-name
entry-type (in/out)
date
time
table: breaklog
id
name
machine-name
date
break-time
now the user has a nice little gui with a login, a logout & a break button.
when a user logs in, an entry is made with entry-type "In", and when he logs out an entry is made with entry-type "Out". once logged in, the break button is activated and when a user goes on a break he has to click on that and once he is back, he has to click that again which makes an entry in the breaklog table with the time he was on break.
in the end i need a table which shows username, login date, login time, logout date, logout time, workhour (time difference between the two), total break-time for the date, final workhour (workhour-total breaktime).
i'm using this query to get that-
i need the query to take only the sum of breaktimes for the particular user for that particular date, what changes should i make to achieve that?
sorry for the long post. please bear with me, i'm kinda n00b at these.
[EDIT: posting original database. thanx GalaxiomAtHome & jdraw for the advice]
i m developing an attendance system for my firm using vb.net to build the frontend and access 2007 as backend. here's my table structure-
table: logins
id
username
password
user category
table: log
id
name
machine-name
entry-type (in/out)
date
time
table: breaklog
id
name
machine-name
date
break-time
now the user has a nice little gui with a login, a logout & a break button.
when a user logs in, an entry is made with entry-type "In", and when he logs out an entry is made with entry-type "Out". once logged in, the break button is activated and when a user goes on a break he has to click on that and once he is back, he has to click that again which makes an entry in the breaklog table with the time he was on break.
in the end i need a table which shows username, login date, login time, logout date, logout time, workhour (time difference between the two), total break-time for the date, final workhour (workhour-total breaktime).
i'm using this query to get that-
problem is when i run this query, the sum(breaklog.break-time) takes all the breaktimes under a user & doubles it. what m i doing wrong here?SELECT log.name,
log.date,
Min(log.time) AS login_time,
log.date,
Max(log.time) AS logout_time,
(DateDiff("s",Min(log.time),Max(log.time))) AS working_hr,
Sum(breaklog.break-time) AS break,
(((DateDiff("s",Min(log.time),Max(time))))-(Sum(breaklog.break-time))) AS total_working_hr
FROM log INNER JOIN breaklog ON log.name=breaklog.name
GROUP BY log.name, log.date;
i need the query to take only the sum of breaktimes for the particular user for that particular date, what changes should i make to achieve that?
sorry for the long post. please bear with me, i'm kinda n00b at these.
[EDIT: posting original database. thanx GalaxiomAtHome & jdraw for the advice]
Attachments
Last edited: