Basic SQL Query Assistance

WHERE  publisherid IN (3,746)

is the same as

WHERE  (publisherid = 3 OR publisherid = 746)

Oops, I just saw there is another IN clause in your query 🙂

IN is perfect in this context. You can use EXISTS instead, if you like that better (I don’t):

SELECT firstname, lastname
FROM author a
WHERE EXISTS
(
  SELECT NULL
  FROM published_by p
  JOIN written_by  w ON w.bookdescid = p.bookdescid
  WHERE p.publisherid IN (3,746)
  AND NOT w.role LIKE ('%translator%')
  AND NOT p.role LIKE ('%editor%')
  AND w.authorid = a.authorid
);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top