IN clause and a string

1

Good morning.

I am trying to make a query in MySQL given the following cases.

Table codings

id| nombre
------------------------
1 | Correo electronico
2 | Videoconferencia
3 | Foro
4 | Otros

Table tutorials

id|tipo_tutoria
------------
1|1,3
2|2,4
3|2
4|1,2,3
5|

Given these tables, the result I would like to achieve is the following:

id|tipo_tutoria
------------
1|Correo electronico,Foro
2|Videoconferencia,Otros
3|Videoconferencia
4|Correo electronico,Videoconferencia,Foro
5|

The most I have come to achieve is the following query:

  

SELECT GROUP_CONCAT (name)   FROM encodings   WHERE find_in_set (       id, (SELECT type_tutoria FROM tutorías)   );

Getting the following result:

id|tipo
------------
1|Correo electronico
2|Videoconferencia
3|Videoconferencia
4|Correo electronico
5|

Any help would be very much appreciated. Greetings!

    
asked by Cristian B. 22.09.2017 в 13:43
source

1 answer

-2

It is already solved. After talking to the analyst we have come to the point of modifying the behavior of the table so that it saves each id as a new record, and thus have a clean design.

Thank you very much for the help fellow.

Greetings

    
answered by 25.09.2017 в 15:06