title: Subquery with Ties
body: <p><strong>Goal</strong>: Show the ID, title of the books and the pub. Year for the book with the highest sales amount; include ties. Use the total extended cost (quantity * order price) when determining the sales of a book.</p>
  
  <p><strong>Rules</strong>: </p>
  
  <ul>
  <li>use subquery only</li>
  <li>no joins</li>
  <li>no union</li>
  <li>only subquery</li>
  </ul>
  
  <p><strong>Query</strong>:</p>
  
  <pre><code>SELECT  book_id,
          title,
          year_publd
  FROM bkinfo.books
  where book_id =
      (
      SELECT TOP 1 WITH TIES book_id, quantity*order_price as Extended_cost
      from bkorders.order_details
      order by quantity*order_price DESC
      )
  ;
  </code></pre>
  
  <p><strong>Error</strong>:</p>
  
  <blockquote>
    <p>Msg 116, Level 16, State 1, Line 10 Only one expression can be
    specified in the select list when the subquery is not introduced with
    EXISTS.</p>
  </blockquote>
  
  <p>The subquery shows the book_id with the highest amount but when running it as a whole, I receive an error. Please explain what I should do.</p>