FIND_IN_SET() vs IN()

前端 未结 6 799
滥情空心
滥情空心 2020-11-22 06:20

I have 2 tables in my database. One is for orders, and one is for companies.

Orders has this structure:

OrderID     |     attachedCompanyIDs
-------         


        
6条回答
  •  失恋的感觉
    2020-11-22 07:10

    SELECT o.*, GROUP_CONCAT(c.name) FROM Orders AS o , Company.c
        WHERE FIND_IN_SET(c.CompanyID , o.attachedCompanyIDs) GROUP BY o.attachedCompanyIDs
    

提交回复
热议问题