By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Trouble creating query that counts items

P: 1
Hey there, I am currently making a relational database and I have an order table which consists of; OrderID, CustomerID, FrameID, FrameColour, LensID, CaseID, CaseColour, DateOfOrder, TotalPrice. Could somebody tell me how i can calculate the most popular frame, case and lens separately. ie. counting the most common FrameID in the table etc.. I really do not know how to do it? Urgent help needed as deadline is VERY near and I am panicking! please help me if you can. Thanks a lot!!
Mar 6 '08 #1
Share this Question
Share on Google+
1 Reply


Denburt
Expert 100+
P: 1,356
Hey there, I am currently making a relational database and I have an order table which consists of; OrderID, CustomerID, FrameID, FrameColour, LensID, CaseID, CaseColour, DateOfOrder, TotalPrice. Could somebody tell me how i can calculate the most popular frame, case and lens separately. ie. counting the most common FrameID in the table etc.. I really do not know how to do it? Urgent help needed as deadline is VERY near and I am panicking! please help me if you can. Thanks a lot!!
Start a new query go into sql view and paste the following:
For A count of the Frames (you may want the frame table and not just the FrameId field from this table):
Expand|Select|Wrap|Line Numbers
  1. SELECT FrameID, Count(FrameID) AS CountOfFrameID FROM Frame
  2. GROUP BY FrameID ORDER BY Count(FrameID) DESC;
For a lens replace the above with the lens field name etc.
Hope this helps, oh BTW the title should define what help you need not just "Urgent Help" This will provide you with help much quicker simply because a person such as myself generally doesn't have time to read every thread out here and if I am pressed for time i can glance down at the titles and see one I can quickly answer and thats the person I will help.
Also it sounds impatient and a large number of people here will skip over it just for that reason alone. Every thread here is important and we ALL do our best to help everyone as quickly as we can.Thanks for you help in that matter.
Mar 6 '08 #2

Post your reply

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