I have 3 tables and I need to retrieve a list of users from table Users and send them a notice. But I need to suppress emails to the users listed in tables BlockUsers and BlockDept.
TABLE: USERS
ID - Integer
UserName - varchar(100)
FirstName - varchar(50)
LastName - varchar(50)
Department - varchar(100)
TABLE: BlockUsers
UserName - varchar(80) --Yes I know this doesn't match but I didn't create this DB but I have to support it.
BlockReason - text
TABLE: BlockDept
ID - Integer
Department - varchar(100)
BlockReason - Text
So I just need the users who are not blocked and their department is not blocked.