1
I have a modeling and I’m trying to get information about it, but I’m not getting it, I need to show the user tasks separated by Tipo de Atividade
, the user is in the table WFPessoaTarefa
field login
, see the image of the modeling:
DADOS DAS TABELAS RELACIONADAS
WFPessoaTarefa IdTarefa Login LoginProxEtapa 1 9615 7580 2 7580 3015 3 3015 5461 4 5461 WFTarefa IdTarefa IdEtapa Ordem Nome Descricao LinkDocumento DataInicio DataTermino EnviaEmail Status 1 1 1 Preencher formulário Preencher formulário http://intranet.cocari.local/ 2015-03-27 16:34:00 2015-03-31 16:34:00 1 1 2 2 2 Aprovar contratação Aprovar contratação http://intranet.cocari.local/ 2015-03-27 16:34:00 2015-03-31 16:34:00 1 1 3 3 3 Aprovar contratação Aprovar contratação http://intranet.cocari.local/ 2015-03-15 16:34:00 2015-03-29 16:34:00 1 1 4 4 4 Terminar processo Terminar processo de contratação http://intranet.cocari.local/ 2015-03-19 16:34:00 2015-03-10 16:34:00 1 2 WFEtapa IdEtapa IdAtividade Ordem Nome DuracaoMaxima EnviaEmail Status 1 1 1 Proponente 48 0 1 2 1 2 Gerente 48 1 3 1 3 Gerente Regional 48 1 4 1 4 RH 48 1 WFAtividade IdAtividade Nome NumEtapas Observacao IdTipoAtividade DataCriacao 1 Documento de contratação 4 Nenhuma observação para o momento. 2 2015-03-24 17:03:35 3 Documento de Avaliação 4 Nenhuma 2 2015-03-27 16:27:00 WFTipoAtividade IdTipoAtividade Nome 1 RH 2 Financeiro
What I did was this:
SELECT WFTipoAtividade.IdTipoAtividade, WFTipoAtividade.Nome AS TipoAtividade, WFPessoaTarefa.Login, WFEtapa.Nome, WFAtividade.Nome AS NomeAtividade, WFTarefa.Ordem, WFTarefa.DataInicio, WFTarefa.DataTermino, WFTarefa.`Status` FROM WFTarefa INNER JOIN WFEtapa ON (WFTarefa.IdEtapa = WFEtapa.IdEtapa) INNER JOIN WFAtividade ON (WFEtapa.IdAtividade = WFAtividade.IdAtividade) INNER JOIN WFTipoAtividade ON (WFAtividade.IdTipoAtividade = WFTipoAtividade.IdTipoAtividade) INNER JOIN WFPessoaTarefa ON (WFTarefa.IdTarefa = WFPessoaTarefa.IdTarefa) WHERE WFPessoaTarefa.Login = 9615 GROUP BY WFTipoAtividade.IdTipoAtividade, WFTipoAtividade.Nome, WFPessoaTarefa.Login, WFEtapa.Nome, WFAtividade.Nome, WFTarefa.Ordem, WFTarefa.DataInicio, WFTarefa.DataTermino, WFTarefa.`Status`
When I execute the command fails, that is, it does not show the result, I do not know where I am missing.
I think you can guess what data you have in the database and, from this data, guess what outcome you expect. But it would be more productive for you to edit your question by showing some sample data and explaining what the expected result would be.
– Caffé
Hello @Caffé, you are absolutely right, I just edited the question, but I also do not know if I was very clear.
– adventistapr
The ideal is to show some records of each of the tables and then show how the result of the query would look (as is the expected result). If you ask a full question about SQL a good answer appears here in minutes.
– Caffé
I can’t see anything wrong. Maybe the problem is elsewhere and not in this query with these records. Try to complete this example here: http://sqlfiddle.com/#! 9/fdb4d/3/0, finishing creating the tables with the other fields and making the Insert of the other records. If the query does not work there too, click on "link" (at the bottom of the page) and paste the url generated here so we can evaluate.
– Caffé