Re: distinct count
From: Chris2 (rainofsteel.NOTVALID_at_GETRIDOF.luminousrain.com)
Date: 02/26/05
- Next message: Frank Martin: "Re: Problem with grouping on the last date."
- Previous message: Nathan: "Extract numeric data from column"
- In reply to: Stukmeister: "distinct count"
- Next in thread: John Vinson: "Re: distinct count"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Feb 2005 17:45:59 -0800
"Stukmeister" <Stukmeister@discussions.microsoft.com> wrote in message
news:20C3A123-8A6E-4216-950A-16F4A40F7F95@microsoft.com...
> I want a count of States in Order and am thinking that something
like "select
> count(distinct state) from order;" might work, but it doesn't. I
know that I
> could do two queries with a "group by state" in the first and a
count in the
> second, but I would like to be able to do in one query. Any
thoughts?
The following:
SELECT O1.State
,COUNT(O1.State)
FROM Order AS O1
GROUP BY O1.State
. . . seemed to work ok on my example Addresses table.
Sincerely,
Chris O.
- Next message: Frank Martin: "Re: Problem with grouping on the last date."
- Previous message: Nathan: "Extract numeric data from column"
- In reply to: Stukmeister: "distinct count"
- Next in thread: John Vinson: "Re: distinct count"
- Messages sorted by: [ date ] [ thread ]