Re: multi count
From: Rohtash Kapoor (rohtash_nospam_at_sqlmantra.com)
Date: 07/23/04
- Next message: Eric Sabine: "Re: writing a Delete trigger on a table for cascading effect"
- Previous message: Jeff: "Re: multi count"
- In reply to: Aaron [SQL Server MVP]: "Re: multi count"
- Next in thread: Jeff: "Re: multi count"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 23 Jul 2004 07:27:38 -0700
Are you looking for something like this:
CREATE TABLE Sales
(
Country VARCHAR(10),
TotalSales FLOAT
)
INSERT INTO Sales VALUES ('AA',1000)
INSERT INTO Sales VALUES ('AA',1000)
INSERT INTO Sales VALUES ('BB',1000)
INSERT INTO Sales VALUES ('BB',1000)
INSERT INTO Sales VALUES ('CC',1000)
INSERT INTO Sales VALUES ('CC',1000)
INSERT INTO Sales VALUES ('DD',1000)
INSERT INTO Sales VALUES ('DD',1000)
SELECT Country, SUM(TotalSales)
FROM Sales
GROUP BY Country
--- Rohtash Kapoor "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message news:O26M57LcEHA.2844@TK2MSFTNGP12.phx.gbl... > Can you please show us table structure, sample data, and desired results. > Narrative is usually not enough information and tends to make the real issue > more difficult to uncover. > > http://www.aspfaq.com/5006 > > -- > http://www.aspfaq.com/ > (Reverse address to reply.) > > > > > "Jeff" <gig_bam_takemeout_@verizon.net> wrote in message > news:uEvMY5LcEHA.3988@tk2msftngp13.phx.gbl... > > I need help in writing a statement with the following info. > > > > the field name i want to count is called country > > i want to count each country and display the totals of each.. in one > > statement.. > > i have the following countries: > > USA > > Canada > > UK > > Austrialia > > New Zealand > > Denmark ( and will add new countries as needed) > > > > i tried this type of statement, but isnt working > > > > SELECT COUNT(Select country from rounds where country = 'USA') as Val1 > > > > am i am thr right track here? or all messed up as i believe i am. > > Thanks > > Jeff > > > > > >
- Next message: Eric Sabine: "Re: writing a Delete trigger on a table for cascading effect"
- Previous message: Jeff: "Re: multi count"
- In reply to: Aaron [SQL Server MVP]: "Re: multi count"
- Next in thread: Jeff: "Re: multi count"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|