473,396 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting a best selling brands list

I know this should be easy but for some reason I have hit a blank. I am basically trying to get a list of the best selling brands for a SQL database. I have three tables: Brand, Product, Orders

I need to select the top 40 selling brands and the total number of all that brands products sold.

This is what I have so far but it isn't counting the products sold properly.
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT TOP (40) Brand_Name, products_Sold
  2. FROM Products 
  3. INNER JOIN  Orders ON Products.ID = Orders.ProdID 
  4. INNER JOIN  Brand ON Products.brandID = Brand.ID
  5. ORDER BY products_Sold DESC
  6.  
Feb 13 '07 #1
0 1464

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: RR | last post by:
Please take a look at the list of books I am selling for cheap. These prices are below what the used dealers are selling them for. If you really want a book and the price is close we may beable to...
303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
131
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately...
15
by: Colin | last post by:
I have a query that calculates the selling price of products on customer orders. Selling prices are calculated based on the average cost of the items when purchased. As I make new purchases, the...
4
by: Bill Borg | last post by:
Hello, I have a large commerce app, hosted for several hundred companies (i.e. each "company" is a small business selling something through my site, independent of all the others). Each...
24
by: invitro81 | last post by:
Hello I've recently learnt python and I do love it! I congratulate all those geeks who produce this nice language; well, because I could be called a nearby newbee I've decided to improve my...
0
by: hostingfreak_y | last post by:
Looking for a good hosting provider? The following site lists the current best selling hosting providers for shared and dedicated hosting. Best selling means there must be people who are...
1
by: Marc | last post by:
Hi there, Most of you php programmers will, one day, decide to publish your code on a decent web host. May the following site help you make a decision: http://hosting.woohoow.net Contains...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.