Result group_concat not working in IN state

Is there any possible way to put the result of group_concat in an IN clause of a SQL query.

Here, in the main network table, I separate the fields in the industryId column with commas. How,

userId     industryId
123        3831
123        2832,3832
123        3833

Example:

select group_concat (industrialId order by cId SEPARATOR ',') from network_master, where userId = 123

and it gives me this type of output 3831.2832,3832,3833 I got this type of output using the top query,

userId      industryId
123         3831,2832,3832,3833

and now I have done it,

select * from industry_master, where inInd in (select group_concat (industrialId order by cId SEPARATOR ',') from network_master, where userId = 123 group by userId);

In this query result, I received only industryId = 3831 data. I did not receive other identifiers.

industryId . mysql.

.

+4
2

, . > 0, .

?

select * from industry_master where find_in_set(industryId,  (select group_concat(industryId order by cId SEPARATOR ',') 
from network_master where userId = 123 group by userId)); 
+3

group_concat IN,

  select i.* 
  from industry_master i
  INNER JOIN network_master  n on  i.industryId = n.industryId 
  AND n.userId =123

group_concat , , IN .

, field_in_set > 0

select * from industry_master 
where find_in_set(industryId,  select group_concat(industryId order by cId SEPARATOR ',') 
      from network_master where userId =123 group by userId)   ;

+2

Source: https://habr.com/ru/post/1694578/


All Articles