I would like to create a query where it selects row from a table based on few conditions which I can accomplish quite fine. However, I would like to figure out how to only show rows from table if the id of that record has not appeared in another table in the past 24 hours. How would I go about doing something like this imagine. Imagine the table was like:
ID . | EMAIL . | . PASS
------------- | --------------- | ---------------
1 . [email protected] . rgjoegeijerioge
2 . [email protected] . dgnkjrkjhrnjkrt
3 . [email protected] . etjhrnkrjkjhjhr
------------- | --------------- | --------------- | ---------------
transferID . ACCOUNT . ACCOUNTTO . ITEM
------------- | --------------- | --------------- | ---------------
1 . [email protected] . [email protected] . book1
2 . [email protected] . [email protected] book2
3 . [email protected] [email protected] book2
so therefore I would want to get all rows from the first table where the email/user (or even userID if I change the table structure) hasn't been part of a row thats been added to second table in the last 24 hours.
You can use
NOT EXISTS
assuming you have a column called
insertion_date
intable2