All pastes #2068619 Raw Edit

Mine

public text v1 · immutable
#2068619 ·published 2011-05-24 19:34 UTC
rendered paste body


select count(distinct publisher.publisher_id) as num_publishers, count(distinct book.publisher_id) as num_publishers_with_books
from publisher left join book on publisher.publisher_id = book.book_id


or two separate statements:

select count(*) from publishers

select count(distinct publisher_id) from book