Forum OpenACS Q&A: Response to Query return 0 row

Collapse
Posted by Michael A. Cleverly on
The above query is kind of redundant. Presumably user_id is constrained to be unique in the users table, so rather than counting and grouping by user_id (when your where clause constrains us to user_id = 3) you could do:
select count(*) from users where user_id=3
and Postgres will return one row (the value being either 0 or 1). The row only "disappears" when you add the group by clause.