Solved

While loop in sql

Posted on 2013-01-25
2
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Select - Finding chars in a column 2 71
passing parameter in sql procedure 9 68
Table create permissions on SQL Server 2005 9 45
INSERT DATE FROM STRING COLUMN 18 63
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…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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