Re: Stupid SQL Question:

Jonathan Ellis <jellis@advocast.com>

From: "Jonathan Ellis" <jellis@advocast.com>
To: <pgsql-general@postgresql.org>
Date: 2000-11-15T00:47:55Z
Lists: pgsql-general
> 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';

A WHERE clause must come before a GROUP BY clause.

Also note that if you are using a table with the row defined as datetime
instead of date, you will need something like
WHERE InjDate > '2000-11-14' and InjDate < '2000-11-15'
since unless you specify minutes and seconds, a datetime will assume you
mean 0:00.

-Jonathan