I have a field delimited by '->'. I want to do a total count of which value appears most or top 3
ROW 1- "Q -> Res -> tes -> Res -> twet"
ROW 2- "rw -> gewg -> tes -> Res -> twet"
ROW 3- "Y -> Res -> Res -> Res -> twet"
Answer to this example would be:
Top 1- Res |6
Top 2- tewt|3
Top 3- tes |2
Ive tried:
( select count(*) from unnest(split(text, ' -> ')) word where word = 'Res' ) cnt from table
but i need to do it dynamically instead of putting in every word
