Complementing with current information, I understood the current result, and what it looks like is duplicate information, but on different tables, but this is not even with me since I arrived and it was like this and I'm still an intern, I'm just studying this bank. I'm still looking to better understand the use of JOINS.
=================================================================
I'mtryingtomakeaqueryasfollows:
SELECTp.idPessoaASID_PESSOA,p.nomeASTITULAR,d.idDependenteASID_DEPENDENTE,d.nomeASDEPENDENTE,c.valorAuxilioASVALOR_AUXILIOFROMsca_pessoapINNERJOINsca_dependentedONp.idPessoa=d.idPessoaINNERJOINsispro_contratocONp.idPessoa=c.idPessoaWHEREp.nomeLIKE'%ADEMARMAGA%'ANDc.idSituacaoContrato=3ANDc.valorAuxilioISNOTNULL;
Iwouldlikeyoutohavethefollowingresult:NAMEHOLDER,DEPENDENTNAMEandAUXILIARYVALUEthatwouldbethevalueofeach(2xpeople)asperthetablebelow.
Thenametablesispro_contratohasthefollowingvalues:
What would be wrong or missing?
If I take the AND c.valorAuxilio ; null returns as follows:
Following the structures of the tables:
sca_pessoa
idPessoa int(10) unsigned
matricula varchar(45)
nome varchar(100)
telefoneResidencial char(13)
telefoneCelular char(13)
telefoneUnidade char(13)
email varchar(100)
dtAdmissao date
dtNascimento date
idSituacao int(4)
SalarioReferencia int(10) unsigned
idCargo int(10)
idLotacao int(11)
cpf varchar(45)
codigoLotacao varchar(45)
funcaoValorInicialVertical varchar(45)
funcaoValorInicialHorizontal varchar(45)
idFuncao int(11) unsigned
sexo char(1)
rg varchar(15)
nomePai varchar(44)
nomeMae varchar(44)
gsanguineo varchar(3)
rh varchar(3)
ativo char(1)
sca_dependente
idDependente int(10) unsigned
idPessoa int(11) unsigned
nome varchar(100)
dtNascimento date
idParentesco int(11) unsigned
pensionista tinyint(3) unsigned
universitario tinyint(3) unsigned
pne tinyint(3) unsigned
comprovanteEscolar tinyint(3)
sispro_contrato
idContrato int(10) unsigned
idOperadora int(10) unsigned
proposta varchar(45)
ans varchar(45)
valor decimal(10,2)
idPessoa int(10) unsigned
idFormaDePagamento int(10) unsigned
idSituacaoContrato int(10) unsigned
idOperadorUltimaAtualizacao varchar(45)
dataContrato date
dataEncaminhamento date
dataDeferimento date
dataHoraUltimaAlteracao datetime
dataRequerimento date
dataSituacaoAtual date
dataSuspensao date
dataCancelamento date
idProcesso int(11) unsigned
valorAuxilio decimal(10,2)
idDependente int(10) unsigned
idOperador varchar(45)
idTipoOperadora int(10) unsigned
valorTotalAuxilio decimal(10,2)