I have two tables in an SQL Server database, one with two columns and one with four:
tbl_email_list
email_list_id
int
(PK)email_list_name
varchar
tbl_email-details
email_uniq_id
int
(PK)email_list_id
int
(FK)email_address
varchar
blacklist
bit
I want to retrieve data in one query which should return
- All the email lists from tbl_email_list;
- The total number of email_address associated with a specific email_list_id;
- The total number of whitelisted email addresses (where blacklist=0);
- The total number of blacklisted email addresses (where blacklist=1).