I have a table as follow:
id g_n val_name
---------------------
1 a "a"
2 a "aa"
3 b "123"
4 b "asad"
5 c "aas1"
I want to count the number of distinct g_n. (Here it's 3.)
I have tried with:
select count(*)
from table_t
group by g_n
But it gives me the number of items per group.
How can I count the number of distinct g_n?