Re: Stupid SQL Question: - Mailing list pgsql-general

From Michael Fork
Subject Re: Stupid SQL Question:
Date
Msg-id Pine.BSI.4.21.0011141946530.26240-100000@glass.toledolink.com
Whole thread Raw
In response to Stupid SQL Question:  (shawn everett <everett@pgweb.com>)
Responses Re: Stupid SQL Question:
List pgsql-general
Try these queries...

SELECT injdate, outcome, count(outcome) FROM safety GROUP BY
injdate,outcome;

or

SELECT outcome, count(outcome) FROM safety WHERE injdate='2000-11-14'
GROUP BY outcome;



Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio

On Tue, 14 Nov 2000, shawn everett wrote:

> I have a table defined as follows:
>
> CREATE TABLE safety (
>     sid SERIAL,
>     side INTEGER,
>     InjDate DATE,
>     InjType INTEGER,
>     Outcome INTEGER,
>     PRIMARY KEY (sid)
> );
>
> What I'm trying to generate is a list of all outcomes and how many of each
> that occured for a particular range of dates.
>
> This works but doesn't do dates:
>
> SELECT outcome,count(outcome) from safety
> GROUP BY outcome;
>
> How do I incorporte dates into this query.
>
> Adding a WHERE clause to the query doesn't work for example:
>
> SELECT outcome,count(outcome) from safety
> GROUP BY outcome
> WHERE InjDate='2000-11'14';
>
> Any tips or advice would be apreciated.
>
> Shawn
>


pgsql-general by date:

Previous
From: "Jonathan Ellis"
Date:
Subject: Re: Stupid SQL Question:
Next
From: shawn everett
Date:
Subject: Re: Stupid SQL Question: