Quantcast
Channel: Join two tables and return data and count in a single query - Database Administrators Stack Exchange
Browsing latest articles
Browse All 3 View Live

Answer by Rob Farley for Join two tables and return data and count in a...

select l.email_list_id, l.email_list_name, count(d.email_uniq_id) as full_count, count(case when d.blacklist = 0 then d.email_uniq_id end) as white_count, count(case when d.blacklist = 1 then...

View Article



Answer by Bogdan Bogdanov for Join two tables and return data and count in a...

Try something like this:SELECT el.emali_list_name AS EmailList,COUNT(*) AS EmailsCount ,SUM(CASE WHEN ed.blacklist = 1 THEN 1 ELSE 0 END) AS BlackList4ListCouint,SUM(CASE WHEN ed.blacklist = 0 THEN 1...

View Article

Join two tables and return data and count in a single query

I have two tables in an SQL Server database, one with two columns and one with four:tbl_email_listemail_list_idint (PK)email_list_namevarchartbl_email-detailsemail_uniq_idint (PK)email_list_idint...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images