counting query

From: garry saddington <garry(at)schoolteachers(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: counting query
Date: 2007-01-28 13:05:44
Message-ID: 1169989544.29309.76.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table definition such as:

CREATE TABLE attendance
(
attendanceid serial primary key,
entered date DEFAULT current_date NOT NULL,
absent boolean,
authorization text default 'N',
timeperiod char(2) check(timeperiod in('AM','PM')),
days varchar(10),
studentid int,
unique(entered,timeperiod,studentid)
)

Which is used to record school attendance data. I am now trying to write
a query to identify trends in absences by counting the days column and
returning any student that has repeated absences on certain days. I am
struggling to return anything that does not need further manipulation in
Python before being useful.
Does anyone have any ideas?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shane Ambler 2007-01-28 13:39:35 Re: Predicted lifespan of different PostgreSQL branches
Previous Message Dave Page 2007-01-28 10:04:45 Re: Predicted lifespan of different PostgreSQL branches