Solved

While loop in sql

Posted on 2013-01-25
2
376 Views
Last Modified: 2013-01-25
Hi. I have following task.
1) Find number of orders for the different shipping fee.
The result should be like:
ShippingFee:      OrderCount:
70                        150
90                         140

And so on.

I was thinking abount a while loop in sql, but don´t know how:

while (select distinct shippingfee from orders)
(
select count(orderid) from orders where shippingfee = shippingfee
)
Can somebody help me?
0
Comment
Question by:bongii
2 Comments
 
LVL 17

Accepted Solution

by:
aflockhart earned 500 total points
ID: 38817863
select
shippingfee,count(orderid)
FROM orders
GROUP BY shippingfee
0
 

Author Closing Comment

by:bongii
ID: 38817952
Nice :=)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question