Get 0 value from a count with no rows

后端 未结 6 1121

I have SELECT:

SELECT c FROM (
    SELECT "candidate_id" as id, count("candidate_id") as c
    FROM "Applicaions"
    GROUP BY &         


        
6条回答
  •  执笔经年
    2020-12-14 17:46

    Can't you use this statement:

    SELECT count("candidate_id") as c
    FROM "Applicaions" WHERE "candidate_id"=_SOME_ID_
    GROUP BY "candidate_id"
    

    It should return count() and you don't need subquery.

    EDIT: Matthew PK is correct and Andy Paton has better answer ;)

提交回复
热议问题