Re: [GENERAL] Dumb question about count()

2005-07-22 Thread Ezequiel Tolnay
Benjamin Smith wrote: Now, I want to get a result like: classroom | students | seats 101A 0 25 101B22 30 102A11 0 ... etc. Something somewhat akin to select classroom.title, count(students.id) AS students, count(seats.id) AS seats from classrooms, students, seats wh

Re: [GENERAL] Dumb question about count()

2005-07-21 Thread Michael Fuhr
On Thu, Jul 21, 2005 at 10:09:07PM -0700, Benjamin Smith wrote: > select classroom.title, > count(students.id) AS students, > count(seats.id) AS seats > from classrooms, students, seats > where classrooms.id=students.classrooms_id > and classrooms.id=seats.id > > Except that it coun

[GENERAL] Dumb question about count()

2005-07-21 Thread Benjamin Smith
I'm sure I've done this before, but for some reason, my main noodle is drawing a blank. Assume we have three tables defined thusly: create table classrooms ( id serial unique not null, name varchar ); create table seats ( classrooms_id integer not null references classrooms(id), position var