-1

I have two different tables one is for the post and other one is for the user those who are read the post. Now i need to get the unread post count of a particular user using a single query with post_category & user_id in where conditions . the table structure is given below

POST Table

  • post_id
  • post_category
  • post_title
  • post_status

USER READ TABLE

  • post_id
  • user_id
Your Common Sense
  • 154,967
  • 38
  • 205
  • 325
samuel
  • 61
  • 1
  • 7
  • You need another table with all the users. – Barmar May 12 '22 at 16:24
  • See https://stackoverflow.com/questions/21633115/return-row-only-if-value-doesnt-exist?lq=1 for how to get all the posts that haven't been read by a user. Then use `COUNT(*)` and `GROUP BY users.user_id` to get the unread counts. – Barmar May 12 '22 at 16:26

0 Answers0