2015-04-07 10:21 GMT-03:00 Alessandro Lima <grandegoia...@gmail.com>: >>>Cadê a consulta? > > SELECT prospects.nome AS nomeProspect, prospects.codigo AS codigoProspect, > prospects.dataCadastro AS dataCadastro, prospects.telefoneResidencial AS > telRes, prospects.telefoneComercial AS telComer, prospects.celular AS cel, > prospects.telefoneRecado AS telRec, prospects.emailPrincipal AS email, > interacaoworkflow.datainicio AS dataContato, interacaoworkflow.observacao AS > observacao, situacaoprospectpipeline.controle AS > controleSituacaoProspectPipeline, turma.identificadorturma AS turma, > curso.nome AS nomeCurso, curso.codigo AS codigoCurso, consultorPadrao.nome > AS nomeConsultorPadrao, pessoaResponsavel.nome AS nomeResponsavel, > matricula.matricula, c3.nome AS cursoMatriculado, ( SELECT count ( > matricula.matricula ) FROM matricula WHERE aluno = pessoaProspect.codigo AND > matricula.situacao = 'AT' ) > 0 AS possuiMatricula > FROM prospects > LEFT JOIN pessoa AS pessoaProspect ON pessoaProspect.codigo = > prospects.pessoa > LEFT JOIN interacaoworkflow ON interacaoworkflow.codigo = ( SELECT > iwf.codigo FROM interacaoworkflow iwf WHERE prospects.codigo = iwf.prospect > ORDER BY datainicio DESC LIMIT 1 ) > > (corte)
Antes de continuar, todos estes LEFT JOINs estão certos? A intenção é usá-los mesmo? TIAGO J. ADAMI http://www.adamiworks.com @tiadami _______________________________________________ pgbr-geral mailing list pgbr-geral@listas.postgresql.org.br https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral