Help me, there are two tables,
orgtypes
- Contains types of organizations
id |name | -------------------------- 1 |Организация 1| 1 |Организация 1| 1 |Организация 1| 1 |Организация 1|
orgs
- contains selected types of organizations
id |user_id | types -------------------------- 1 |1 |1 1 |1 |3 1 |2 |2 1 |2 |4
Need to get a table
id | user | ogrs -------------------------- 1 | 1 | Организация 1,Организация 3 1 | 2 | Организация,Организация 4
So here. I can not understand how JOIN
does not fit because they do not have a common column, (SELECT orgs.user_id, GROUP_CONCAT(orgs.types) FROM orgs WHERE orgs.types IN( SELECT orgtypes.name,orgtypes.name FROM orgtypes))
?? unclear