I tried : WITH posts_tags_cte AS ( SELECT post_id, array_agg(tag_id) as tags FROM posts_tags WHERE tag_id in (1, 2) GROUP BY post_id ) WHERE posts_tags_cte.tags @> array[1, 2]::int8[] But it gives me all the posts.
|
I tried : WITH posts_tags_cte AS ( SELECT post_id, array_agg(tag_id) as tags FROM posts_tags WHERE tag_id in (1, 2) GROUP BY post_id ) WHERE posts_tags_cte.tags @> array[1, 2]::int8[] But it gives me all the posts.
|