MySQL sql statement question
-
I have the following statment:
SELECT * FROM member_channels WHERE member_channel_address = param_member_channel_address;
that's member_channels where I also have member_channel_id (primary key) In member_posts, I have member_channel_id.. I want to count total posts linked to member_channel_id and I want to display it as count field in the above statement..
-
I have the following statment:
SELECT * FROM member_channels WHERE member_channel_address = param_member_channel_address;
that's member_channels where I also have member_channel_id (primary key) In member_posts, I have member_channel_id.. I want to count total posts linked to member_channel_id and I want to display it as count field in the above statement..
-
Something like the following SELECT *, count(p.member_channel_id) FROM member_channels c, member_posts p WHERE c.member_channel_address = param_member_channel_address and c.id = p.member_channel_id
thanks but there is one problem. when member_post has no rows linked to the same member_channel_id, it will not return anything but I want it to return the details with zero count
-
thanks but there is one problem. when member_post has no rows linked to the same member_channel_id, it will not return anything but I want it to return the details with zero count