News for hackers. Stuff that matters.
Re:Ask HN: What's your speciality, and what's your "FizzBuzz... by hartleybrody on Thursday January 02, 2014 @01:48PM (#7001317)
My solution:

    SELECT authors.name, SUM(sales.price) FROM authors
      INNER JOIN books ON authors.id = books.author_id
      INNER JOIN sales ON books.id = sales.book_id
      WHERE sales.date >= Nov 2013 AND sales.date < Dec 2013
      GROUP BY authors.name
Although a coworker pointed out that inner joins would drop authors who haven't written books, and books that have no sales. If you want to include all of those, then use LEFT OUTER JOIN instead of INNER JOINs.

There are no comments on this comment yet.