sum( (record_id is NULL AND joined.table_id is NULL)::int )
I know the sum returns the sum of the column entries, but what will this expression (… and…) return, can it be compared with this expression (.. + ..), and what does this ()::int?? convert result to int?
i dont know will return this expression, on my sampling will returned number of integer
2
Answers
(record_id is NULL AND joined.table_id is NULL)::int
will return 1 iff bothrecord_id
andjoined.table_id
are null.Therefore,
sum( (record_id is NULL AND joined.table_id is NULL)::int )
will return the number of rows in which bothrecord_id
andjoined.table_id
are null.It is a more complicated way to write