May 10, 2013 at 4:14 am
Hi
i have a table with 4 columns
YearMonthProd-Group ProductValue
2010April Fruit Oranges2
2010April SweetsCad bury3
2010AugustToys Doll 5.5
2011AugustFruit apple1
2011DecemberFruit pear 2
2012FebruaryToys car 10
2012July Sweets choc3.5
Is it possible for me to get a summary of this for example i want to know from the Prod-Group column which one appears the most
E.G. i would like my results to be like: Fruit
May 10, 2013 at 5:09 am
Is this homework? What have you tried so far?
Here's a hint: use GROUP BY and COUNT(*) in a CTE or subquery to find out how many of each product there are, and then use MAX to find out which one has the most.
John
May 10, 2013 at 7:25 am
i am an intern just started sql never touched it in my life now i have to create a report fro the client ... i have done the report i am left with this
May 10, 2013 at 4:43 pm
I don't know... being an intern means that you're supposed to be learning some things from the people you're working for. You should have a mentor that's been assigned to you. I'd ask the mentor to show you. Nothing better than face-to-face training/learning.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply