Filtering many to many relations

Does anyone know how to filter based on two tables with a many to many relations? I keep geeting the following error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tags' in 'where clause'

SELECT
count(*) AS aggregate
FROM
tasks
WHERE
(
tags
IN (2))
Was this page helpful?