Trouble creating query that counts items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kushuk
    New Member
    • Mar 2008
    • 1

    Trouble creating query that counts items

    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!!
  • Denburt
    Recognized Expert Top Contributor
    • Mar 2007
    • 1356

    #2
    Originally posted by kushuk
    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):
    [CODE=SQL]SELECT FrameID, Count(FrameID) AS CountOfFrameID FROM Frame
    GROUP BY FrameID ORDER BY Count(FrameID) DESC;[/CODE]
    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.

    Comment

    Working...