Hello.
I have 2 tables. One table (called ITAS_USER) contains one column (EMPLID) and this table holds 600+ EMPLID numbers. These are all the people who should be entering data in a survey.
The other table (TIME_RECORD) contains the hours they record, with the principal columns being EMPLID, D_WKST (the week that the hours are recorded for) and HOURS (number of hours).
What I would like my query to do is select the EMPLIDs of the users who have NOT entered hours for a particular week, so that an email can be sent to them.
This query selects those have entered hours in the week beginning 04-10-2004
I would like to be able to cross-reference my results against the ITAS_USER table to find the users who have NOT entered any hours. Simply put, if they appear in the ITAS_USER table, but have a total of 0 hours entered in the TIME_RECORD table, they should be selected.
Thank you.
I have 2 tables. One table (called ITAS_USER) contains one column (EMPLID) and this table holds 600+ EMPLID numbers. These are all the people who should be entering data in a survey.
The other table (TIME_RECORD) contains the hours they record, with the principal columns being EMPLID, D_WKST (the week that the hours are recorded for) and HOURS (number of hours).
What I would like my query to do is select the EMPLIDs of the users who have NOT entered hours for a particular week, so that an email can be sent to them.
This query selects those have entered hours in the week beginning 04-10-2004
Code:
select distinct
tr.emplid,
tr.d_wkst,
nvl(sum(tr.hours), 0)
from
ita.time_record tr
where
tr.d_wkst = TO_DATE('2004-10-04', 'YYYY-MM-DD')
group by
tr.emplid,
tr.d_wkst
I would like to be able to cross-reference my results against the ITAS_USER table to find the users who have NOT entered any hours. Simply put, if they appear in the ITAS_USER table, but have a total of 0 hours entered in the TIME_RECORD table, they should be selected.
Thank you.