SQL query help? - Mailing list pgsql-sql

From John McGough
Subject SQL query help?
Date
Msg-id 393ddoF5pqrfaU1@individual.net
Whole thread Raw
Responses Re: SQL query help?
Re: SQL query help?
List pgsql-sql
SELECT Count(*) FROM Work WHERE (UserID='user1' AND MAX(Finished)=0)

Work:-
+---+-------+--------+---------+----------+| ID | JobID | UserID | Finished  | Comment |
+---+-------+--------+---------+----------+|  1  |     1    |   user1  |     0         |      ...        ||  2  |     1
  |   user1  |     1         |      ...        ||  3  |     2    |   user2  |     0         |      ...        ||  4  |
  3    |   user1  |     0         |      ...        ||  5  |     2    |   user2  |     0         |      ...        ||
6 |     2    |   user1  |     1         |      ...        ||  7  |     3    |   user1  |     0         |      ...
|
 
+---+-------+--------+---------+----------+

All I want it to do is return the number of unfinished jobs for a specific
user.

In this example it would return 1 because job number 3 is not finished and
user1 was the last person working on it.

but I keep getting MySQL error #1111 - Invalid use of group function





pgsql-sql by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: drop view even with dependencies?
Next
From: "Goulet, Dick"
Date:
Subject: Re: [ADMIN] Postgres schema comparison.