selects on datetime - Mailing list pgsql-general

From Scot Brady
Subject selects on datetime
Date
Msg-id 81CA33A8DC6DD211AA0300A0C95D659F719C@ADMIN401
Whole thread Raw
List pgsql-general

Hello all,

I have a table w/ a field of type datetime. I would like to do something like:
select count(jobs) for every day of a particular month and year.

my current select statement is:
Select count(job_id) from jobs where date_part('month',sub_dt)=2 and date_part('year',sub_dt)=1999 and date_
part('day',sub_dt)=?";

I then execute the statement filling the placeholder with days 1..31

There has to be a better way to do this since the select has to go through every row in the table. Any ideas?

thanks,
scot b.

pgsql-general by date:

Previous
From: Paulo da Silva
Date:
Subject: A security problem (newbie)
Next
From:
Date:
Subject: Undeliverable Message