I have 2 tables in my database. One is for orders, and one is for companies.
Orders has this structure:
OrderID | attachedCompanyIDs -------
To get the all related companies name, not based on particular Id.
SELECT (SELECT GROUP_CONCAT(cmp.cmpny_name) FROM company cmp WHERE FIND_IN_SET(cmp.CompanyID, odr.attachedCompanyIDs) ) AS COMPANIES FROM orders odr