View Single Post
  #1 (permalink)  
Old 02-22-2007, 09:25 AM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,702
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default 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.
__________________
The best way to learn anything, is to question everything.
Interestingly Average Security Blog