मुझे लगता है कि आपको userid
. के साथ योइन करना होगा और postId
select
a.userId,
sum(a.postStatus = 0) published,
sum(a.postStatus = 1) inactive,
sum(a.postStatus = 5) recalled,
sum(a.postStatus = 6) deleted,
sum(b.postStatus = 10) unChecked
from userData a join userdatamod b on a.userId = b.userId and a.postId=b.postId where a.userId = 1;