| From: | shawn everett <everett(at)pgweb(dot)com> |
|---|---|
| To: | <pgsql-general(at)postgresql(dot)org> |
| Subject: | Stupid SQL Question: |
| Date: | 2000-11-15 00:18:39 |
| Message-ID: | Pine.LNX.4.30.0011141612570.9125-100000@alder.pgweb.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jonathan Ellis | 2000-11-15 00:47:55 | Re: Stupid SQL Question: |
| Previous Message | Philip Hallstrom | 2000-11-15 00:10:23 | Re: [ANNOUNCE] [RELEASE ANNOUNCEMENT] v7.0.3 *Final* now Available |