What should a field in another count table do in an sequelize association query?

2 tables
select
tb1.name as name,
tb1.id as id,
(select count (1) from tb2 where tb1.type = tb2.type) as count
from tb1

clipboard.png

how to implement the sequelize method, and how to get such a result
is using include, and how to write where.

Apr.02,2021

use include

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e435db-44a41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e435db-44a41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?