Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting order values below a certain amount

Status
Not open for further replies.

jcmeyer5

Technical User
Oct 10, 2003
7
US
I have a table I created with a make-table query. It has 4 fields. Order Number - Ship Method - Catalog - Amount

I want my table to look like

Ship Method - Catalog - count of orders $25.00 and under - count orders $25.01 to $50.00 - count of orders $50.01 to $100.00 - count of orders $100.01 and over

Try as I might, it wont work. Help me please.

Key field is Order Number/Ship Method combined.
 
[tt]select ShipMethod
, Catalog
, sum(iif(Amount <= 25,1,0))
as &quot;Count of orders $25.00 and under&quot;
, sum(iif(Amount > 25,
and Amount <= 50,1,0))
as &quot;Count orders $25.01 to $50.00&quot;
, sum(iif(Amount > 50,
and Amount <= 100,1,0))
as &quot;Count orders $50.01 to $100.00&quot;
, sum(iif(Amount > 100,1,0))
as &quot;Count of orders $100.01 and over&quot;
from yourtable
group
by ShipMethod
, Catalog[/tt]

rudy
 
Ahhhh... muchos gracias!!

I was able tyo modify that to get to where I wanted (I needed $100 increments up to $10,000).

Thanks! I gotta get me an SQL guide or something!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top