SQL Noob and still learning. I am trying to figure out how to write a query that will look up all people hired on or after a date and then query another database and pull out all the paychecks those people received so far.
Example:
SELECT * FROM db2.paychecks
WHERE paydate >= (SELECT hiredate FROM db1.employees WHERE hiredate >= 2020-01-01)
I know that I cannot use comparison operators with more then one value but I cannot figure out the solution.
Try this (use your connecting column instead of employeeid):
select p.* from db2.paychecks p inner join db1.employees e on p.employeeid=e.employeeid
where e.hiredate>='2020-01-01'