Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Table Posts:
- id body
- 1 test1
- Table user_views
- post_id user_id
- 1 1
- select count(uv.post_id) as views_count,posts.id,posts.body from posts
- left join user_views uv on uv.post_id = posts.id
- group by posts.id
- select count(*) from posts where posts.id not in select post_id from user_views where post_id = posts.id and user_id = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement