Running a query to yield blank/non existent data

jrsarrat

New Member
Joined
Jul 8, 2018
Messages
47
Hello!
I have been struggling with producing a query that will pull all data from one field in a table that doesn’t exist in another table.
I have two tables. The first table holds all employee information. The second table holds log in/log out information.
I want the query to pull the employees whom do not exist in table 2, but do exist in table 1.
Your help is much appreciated.
Thank you!
 
I'm not sure if there is an alternative. What kind of date are you in need of?
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I'm not sure if there is an alternative. What kind of date are you in need of?

The report will be ran daily, so I'm in need of each day's date. The tblEmpLogin table will meet this criterion, but the query does not work when it is Table 1.
 
Upvote 0
THis would find only the employees that don't have a login today (assuming there is a Dte1 field in the login table and it holds dates without times, not dates with times ie (1/1/2018, not 1/1/2018 12:00 PM).
SELECT
T.Emp_FName,
T.Emp_LName,
T.Team_Lead,
T.Role
FROM
Emp_tbl T
WHERE
(
(Not Exists (SELECT * FROM tblEmpLogin where tblEmpLogin.pf_id = T.pf_id and tbleEmplogin.Dte1 = date()))
);


Otherwise I guess the query was returning employees who had never logged in ever.
 
Last edited:
Upvote 0
THis would find only the employees that don't have a login today (assuming there is a Dte1 field in the login table and it holds dates without times, not dates with times ie (1/1/2018, not 1/1/2018 12:00 PM).
SELECT
T.Emp_FName,
T.Emp_LName,
T.Team_Lead,
T.Role
FROM
Emp_tbl T
WHERE
(
(Not Exists (SELECT * FROM tblEmpLogin where tblEmpLogin.pf_id = T.pf_id and tbleEmplogin.Dte1 = date()))
);


Otherwise I guess the query was returning employees who had never logged in ever.

I tested your query with just a few records, and it worked! It even excluded a record which had the Now() expression included (Ironically, I changed the expression before you informed me to do so.) I can’t thank you enough, Xenou!
 
Upvote 0
No problem. Glad I could help.

Hello, again!

One last question. I created a form that end-users will use to log in, and would like for The Emp_tbl (which holds all employee info) to fact-check the end-user's entry when they log in. In case a user accidentally inputs the wrong ID, is there a way for me to apply a command to return an error message prompting the user to try again?
Also, I've noticed currently, if an incorrect ID is entered, the form locks. Will my requested command supersede this glitch?

Thank you!
 
Upvote 0
I don't really deal with login security sorry. Sounds like you have some custom implementation since forms don't lock on their own.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top