こんな感じでしょうか。
ご希望通り列として持つなら https://dev.classmethod.jp/articles/sql-data-horizontal-vertical/ の「縦持ちを横持ちに」を参考に。
配列がいいなら array_agg で。
with data as (
select date('2022-01-01') as mydate,'楽しかったです' as str union all
select date('2022-01-01') as mydate,'楽しかったです' as str union all
select date('2022-01-01') as mydate,'そこそこ' as str union all
select date('2022-01-02') as mydate,'楽しかったです' as str
),
list as (
select '楽し' as word union all
select 'そこ' as word union all
select '微妙' as word
),
result as (
select * from data, list
where data.str like '%'||list.word||'%'
)
select mydate, word, count(*)
from result
group by mydate, word
結果
2022-01-01 | 楽し | 2
2022-01-01 | そこ | 1
2022-01-02 | 楽し | 1
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/02/27 15:33
2022/02/28 01:18