1
Speak guys, is the following, in the MYSQL database I have these 3 tables:
CONTROLS: Here I do the training entries performed. Note that it is possible to insert several employees in the same line
COLLABORATORS:
SECTORS:
The column collaborators of the CONTROL table is a foreign key of the COLLABORATORS table. The column sectors of the COLLABORATORS table is a foreign key of the SECTORS table.
I would like a select that brings me the amount of employees per sector who participated in the training.
Would look like this:
Friend, are you sure about this "foreign key" in the CONTROLS table? It seems to me you are storing a representation of an array in text. I may be wrong, but this is not a FK, and there would be no way you could do this query trivially with this structure.
– Israel Merljak
Yes, it is an array, as I need to insert several contributors in the same row. These records are the contributors table Ids. It works like a FK, but in fact it is not. As far as consultation is possible yes, there must be some way. I’m trying with INNER JOIN, but I still can’t get.
– user116448
Checks if the answer I suggested solves your problem.
– Israel Merljak