Advertisement
JL-ConcepT

Instpubs, SQL, filter Publisher

Dec 1st, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.42 KB | None | 0 0
  1. SELECT
  2.     authors.au_fname AS FirstName, authors.au_lname AS LastName,
  3.     COUNT(DISTINCT publishers.pub_id) AS Publishers
  4. FROM authors
  5.     INNER JOIN titleauthor
  6.         ON dbo.authors.au_id = titleauthor.au_id
  7.     INNER JOIN titles
  8.         ON titleauthor.title_id = titles.title_id
  9.     INNER JOIN publishers
  10.         ON titles.pub_id = publishers.pub_id
  11. GROUP BY authors.au_fname, authors.au_lname
  12. HAVING COUNT(DISTINCT publishers.pub_id) = 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement