0
I have the following structure:
tabela (Grupo):
-cd_grupo
-nm_grupo
-ds_filtros -> Aqui armazeno parte do comando SQL utilizado como filtro , para posteriormente atualizar.
I store the following information.
cd_grupo | nm_ grupo | ds_filtro
1 | grupo1 | AND (uf = 'PR') AND (genero = 'F')
2 | grupo2 | AND (nasc >= '1990-02-20')
there is another link table, where bind employees according to the group filter.
cd_grupo | cd_funcionario
1 | 14
1 | 19
1 | 35
my doubt is necessary to update the link table when changes the status of the employee and when it is inserted working new.
This way down I know it doesn’t work but the idea would be this:
SELECT cd_funcionario FROM funcionario WHERE (SELECT ds_filtros FROM grupo)
That would bring the filters "AND (Uf = 'PR') AND (genero = 'F')" and add after the clause WHERE
Have some alternative to store filters or if this way you have to search for all filters in the group table and apply them in another SQL command be it REPLACE, UPDATE or INSERT ?
I am using PHP with Mysql.
in case the idea is to store the command, not results?
– rLinhares
from what I understood and only you save the result in a variable and then put this variable after the WHERE
– Cyber Hacker
'I store the controls used in the respective filter
– ThiagoCI