I have a table tb1 like this:
id | building | id_connect |
====+==========+============
1 | 1 | "328abbc"
2 | 3 | "328abbc"
3 | 4 | "212a3b"
4 | 1 | "212a3b"
5 | 2 | ""
6 | 2 | ""
7 | 7 | ""
I need to get the count of the distinct id_connect if the string is different to "", but each empty string ("") has to add 1...
In the example, the required result would be 5 (one "328abbc", one "212a3b" and the three ""), but I only obtain 3 with
SELECT COUNT(DISTINCT(id_connect))
FROM tb1