Code: Select all
SELECT `companies`.`companyid`, `companies`.`childCategoryid`, `companies`.`registrationNumber`, `companies`.`name`, `companies`.`website`, `companies`.`phoneNumber`, `companies`.`member`, MATCH(companies.name) AGAINST ('tandläkare') AS `score`, `childCategories`.`name` AS `childCategory`, `companyAddresses`.`address`, `cities`.`name` AS `city` FROM `nr_companies` AS `companies`
INNER JOIN `nr_child_categories` AS `childCategories` ON childCategories.childCategoryid = companies.childCategoryid
INNER JOIN `nr_company_keywords` AS `companyKeywords` ON companyKeywords.companyid = companies.companyid
INNER JOIN `nr_keywords` AS `keywords` ON keywords.keywordid = companyKeywords.keywordid
INNER JOIN `nr_company_addresses` AS `companyAddresses` ON companyAddresses.companyid = companies.companyid
INNER JOIN `nr_cities` AS `cities` ON cities.cityid = companyAddresses.cityid WHERE (MATCH(keywords.word) AGAINST ('tandläkare linköping')) AND (companies.active = "1")Code: Select all
SELECT (DISTINCT companies.companyid)How can I make it only return distinct companyid's?