I have a column stored as jsonb which is an array of number. Values look like this
I’d like to count the total distinct values from this column. I can get the distinct values like below
SELECT DISTINCT JSONB_ARRAY_ELEMENTS_TEXT(aimjoined) AS aims FROM mytable;
I can’t figure out how to count the total number of occurences for each of the unique values.