SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 MAXIMUM SALES
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Christech82
Starting Member

Hungary
20 Posts

Posted - 04/10/2013 :  16:07:25  Show Profile  Reply with Quote
blank

Edited by - Christech82 on 04/14/2013 10:09:59

UnemployedInOz
Yak Posting Veteran

Australia
54 Posts

Posted - 04/10/2013 :  21:27:43  Show Profile  Reply with Quote
Looks ok and will work but should be written like

SELECT MODEL, COUNT(SALES_NUM)
FROM SHOE_MODEL JOIN SALES
ON SHOE_MODEL.SHOE_MODEL_NO = SALES. SHOE_MO_NO
GROUP BY MODEL
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2224 Posts

Posted - 04/11/2013 :  01:12:00  Show Profile  Reply with Quote
>>the most brand new model shoes that got the maximal number of sales
SELECT TOP 1 WITH TIES MODEL, COUNT(SALES_NUM) MaxSales
FROM SHOE_MODEL JOIN SALES
ON SHOE_MODEL.SHOE_MODEL_NO = SALES. SHOE_MO_NO
GROUP BY MODEL
ORDER BY MaxSales DESC
Go to Top of Page

Christech82
Starting Member

Hungary
20 Posts

Posted - 04/11/2013 :  15:53:58  Show Profile  Reply with Quote
quote:
Originally posted by UnemployedInOz

Looks ok and will work but should be written like

SELECT MODEL, COUNT(SALES_NUM)
FROM SHOE_MODEL JOIN SALES
ON SHOE_MODEL.SHOE_MODEL_NO = SALES. SHOE_MO_NO
GROUP BY MODEL



It is working in both ways
Thank you for replying ...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000