I`m trying to mount this query but not getting it. Can someone help?

 WITH teste as (
 SELECT cb.title, cb.amount, count(cc.id) countt FROM cuponagem_benefit cb
 left join cuponagem_cupom cc 
 on cc.benefit_id = cb.id 
 where cc.status != "USABLE"
GROUP by 1, 2
)
SELECT title from teste
WHERE countt < amount

The document you expected this should be explained

Expected answer

Comment From: ghost

https://gorm.io/docs/advanced_query.html#SubQuery