您可以尝试以下查询:
SELECT d.company_name AS 'organisation name',
GROUP_CONCAT(DISTINCT tag.tag) AS 'category',
GROUP_CONCAT(DISTINCT tag1.tag) AS 'conditions', d.contact_describtion AS 'description', d.tel, d.tel2, d.mobile, d.email, d.email2, d.web, d.web2, d.address, d.town, d.county, d.post_code AS 'post code', IF(d.state = 1, "published", "unpublished") AS 'status',d.contact_page_notes AS 'contact history', d.last_contacted_date AS 'last contacted', d.last_updated_date AS 'last updated'
FROM jds4a_directory d
INNER JOIN jds4a_tags_resources res
on d.id = res.resource_id
LEFT JOIN jds4a_tags tag
on tag.id = res.tag_id AND tag.category = 'category'
LEFT JOIN jds4a_tags tag1
on tag1.id = res.tag_id AND tag1.category = 'condition'
GROUP BY res.resource_id
尚未尝试此查询。但它应该会起作用。基本上,您需要使用条件标记名再次加入jds4a\U标记表