title: How to pass ERROR: more than one row returned by a subquery used as an expression
body: <p>The thing is, that I need to return the books and their <code>COUNT</code>, which were in a possession of a reader less times than the <code>AVG</code> of all books being taken by readers. I have prepared this code:</p>
  
  <pre><code>SELECT book.name, book.publisher, COUNT(specimen.taken) FROM book
  LEFT JOIN specimen ON book.isbn = specimen.isbn 
  WHERE (SELECT COUNT(specimen.taken) FROM specimen
  GROUP BY specimen.isbn)  &lt;
  (SELECT CAST(COUNT(specimen.nr) / COUNT(specimen.taken) AS 
  DECIMAL(10,2))
  FROM specimen)
  GROUP BY book.name, book.publisher;
  </code></pre>
  
  <p>but since the result of the first <code>SELECT</code> in the <code>WHERE</code> clause returns the numbers of the times each book was taken, I cannot compare them with the overall average concluded by the second <code>SELECT</code>. Thus I get </p>
  
  <blockquote>
    <p>ERROR: more than one row returned by a subquery used as an expression.</p>
  </blockquote>
  
  <p>Is this the part where I should be using select within selects select or something? All help is appreciated!</p>