How can I select the required records?

Posted by simple on Stack Overflow See other posts from Stack Overflow or by simple
Published on 2010-12-26T23:17:40Z Indexed on 2010/12/26 23:54 UTC
Read the original article Hit count: 149

Filed under:
|
|

Tables:

  • Product: [id, name, brand_id, is_published]
  • Brand: [id, name, is_published]
  • Awards: [id, name]
  • ProductAwards [product_id, award_id]

How do I select the list of PUBLISHED brands along with the number of AWARDS of brand's products that are Published.

I am cool with all the part except issuing the "is_published" restriction when counting Awards.

I hope this is clear; can anyone just suggest where to dig?

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql