Hi all
(just for info, I'm French speaking so if it's more convenient to answer in French, it's also perfect for me

)
Today I was facing an optimization problem : I need to retrieve a list of teachers and, too, a list of "project leader".
Every survey in our current installation are linked to a classical training session (in a classroom with up to 8 trainers). And training is linked to a module that are grouped into a training project so we've a project leader.
In terms of LimeSurvey, we've one [prefix]_tokens_[surveyID] table by the survey. If we've 1500 surveys... 1500 tables.
My problem concerns the optimization : the project leader name is stored in a field `attribute_12` so, if I need to retrieve the list of all project leaders, I'll need to read 1500 tables.
I can do this with a SELECT attribue_12 from #_tokens_survey1 UNION SELECT attribue_12 from #_tokens_survey2 UNION SELECT attribue_12 from #_tokens_survey3 UNION ...
So making a very big union with all tables.
Even if it works (tested with 20 surveys) it's really not optimized at all.
I was speaking about trainers : their names are stored in fields attributes_2 up to attributes_9 (8 trainers) so my big UNION select will be really big.
Does someone has an idea on how retrieving all my project leader / all my trainers without creating an expensive SQL statement ?
THANKS !
(My current statement is already a stored procedure with a loop)