In the current query I have static to 2 columns, but I would like to create columns for each shift that is in another table.
Here the 2 fiddle of what I have:
Update 1 (trying to specify a little more):
The sql
that I show in the examples generates a list of dates in which it consults in the table "lots" how much "number of workers" are assigned for each date, the problem is that I can not find, with sql
, generate N number of columns for the turns. As you can see there is "turn1" and "turn2" with the condition of "id_turnos = 1" and "id_turnos = 2" but I can not make them dynamic, that I generate so many columns for as many turns as there are. As you can see there is a date registered with the "id_turnos = 3".
NOTE: What do they give to close if they do not ask first or request more specification of the question if it is not understood?
Update 2 (image attached):
Current table:
Table to which you want to arrive:
Update 3:
This was my previous question and with which we arrived at the sql that I currently have.