SELECT
tbl_channels.entity_id
, tbl_channel_members.fld_channel_member_id
, tbl_channel_members.fld_active
, clay_golfclub.entity_id
, clay_golfclub.status
, clay_golfclub.publish_data
FROM
claymore.tbl_channel_members
, claymore.tbl_channels
, claymore.clay_golfclub
WHERE (
tbl_channels.entity_id = 6
AND tbl_channels.entity_id = tbl_channel_members.fld_rel_channel_id
AND tbl_channel_members.fld_rel_entity_id = clay_golfclub.entity_id
AND clay_golfclub.status = 'active'
AND clay_golfclub.publish_data = 'y'
AND tbl_channel_members.fld_rel_entity_type = 'golfclub'
AND tbl_channel_members.fld_rel_entity_id = 111
AND tbl_channel_members.fld_active = 1
AND UNIX_TIMESTAMP(tbl_channel_members.fld_membership_expiry_date) >= UNIX_TIMESTAMP(CURDATE())
);