Re: multi count

From: Rohtash Kapoor (rohtash_nospam_at_sqlmantra.com)
Date: 07/23/04


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
> >
> >
>
>


Relevant Pages

  • Re: The Industry choice
    ... > stronger forces. ... > Most sales offices in Warsaw do not employ esp. ... The same is true of plasma-arc cutting for thicker steels, ... to the decision-making process retired to a nice place in the country ...
    (comp.lang.python)
  • The Bush Housing Bust
    ... In hopes of helping him and the Country, ... New home sales plunge to lowest level in 16 1/2 years By MARTIN ... with prices continuing to fall, possibly until this time next year. ... economists said they believed that the extent of the downturn ...
    (misc.survivalism)
  • Re: Still a problem?
    ... the country you import it into, so it won't be as cheap as the source country anyway. ... If I'm not a complete numpty, the only tax you need to pay for European imports is VAT which can be claimed back against sales. ...
    (borland.public.delphi.non-technical)
  • Re: mis spelling of name allows duplicate by mistake
    ... name altogether and make them ask the data administrator ... the customer's country for plotting a graph of sales volume. ...
    (microsoft.public.access.formscoding)
  • Managing security with multiple roles
    ... I have a sales cube with sales and cost data for different countries. ... If User is in Country_A_WithoutCost role, s/he only can see Country A Sales ...
    (microsoft.public.sqlserver.olap)