How can I do in SQL a:
select count(distinct(field))
from table
and the final result don not count empty values?
example:
the final result should be 3 but it shows 4 (due to empty value).
Empty clearly does not mean NULL
, because that is not counted. Let me assume it means an empty string, ''
. If so:
select count(distinct nullif(field, ''))
@Gordon Linoff给出的答案就是解决方案!!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.