Need help creating a MySQL query
I am looking for any help or suggestions I can get to develop an SQL query, and everywhere I have looked I have been unable to find any examples or tutorials that cover this.
I have a MySQL database powering my web site. The database that contains contains the following two tables, one with a list of products (products: SKU, name, description, manufacturer) and the other with a list of orders (orders: orderID, customerID, SKUordered).
The information I need to get from the database is a list of product names from a certain manufacturer (eg SELECT name FROM products WHERE manufacturer='somecompany') and how many times those specific SKUs were ordered (For each result, how many orders table records have SKUordered=SKU of that match) The result I am hoping to get would be in the following form: productname, numberOfOrders for each product by the manufacturer.
Any suggestions you can give me would be greatly appreciated. If you need any clarification on anything, please let me know.
|