Juliana Paixão Posted November 8, 2016 Topic Count: 31 Topics Per Day: 0.01 Content Count: 54 Content Per Day: 0.01 Reputation: 0 Achievement Points: 582 Solved Content: 0 Days Won: 0 Status: Offline Age: 36 Report Posted November 8, 2016 Bom dia, pessoal. Em qual relacionamento das tabelas de RH posso obter o nome da pai, do pai e os dados do cônjuge de um funcionário. At.te, Juliana Paixão Quote
Jair - Fórmula Posted November 8, 2016 Topic Count: 926 Topics Per Day: 0.13 Content Count: 9,097 Content Per Day: 1.31 Reputation: 376 Achievement Points: 109,102 Solved Content: 0 Days Won: 232 Status: Offline Age: 53 Device: Windows Report Posted November 8, 2016 Juliana, boa tarde. Estes dados estão na tabela de Dependentes. Você deverá buscar os dependentes com GRAUPARENTESCO 5, 6 e 7. 5 - Cônjuge 6 - Pai 7 - Mãe Então, seria algo como: Select Pfunc.Chapa, Pfunc.Nome, Case GRAUPARENTESCO When '5' Then 'Cônjuge' When '6' Then 'Pai' When '7' Then 'Mãe' End as GrauParentesco, Pfdepend.Nome From Pfunc Left Join Pfdepend on (PFunc.Chapa=PFDepend.Chapa and Pfunc.CodColigada=PFDepend.CodColigada) Where Pfunc.CodColigada = '1' and (GRAUPARENTESCO in ('5','6','7') or GRAUPARENTESCO is null) order by Pfunc.Chapa, GrauParentesco ou Select Pfunc.Chapa, Pfunc.Nome, Pai.Nome as NomePai, Mae.Nome as NomeMae, Conjuge.Nome as NomeConjuge From Pfunc Left Join Pfdepend Pai on (PFunc.Chapa=Pai.Chapa and Pfunc.CodColigada=Pai.CodColigada and Pai.GRAUPARENTESCO ='6') Left Join Pfdepend Mae on (PFunc.Chapa=Mae.Chapa and Pfunc.CodColigada=Mae.CodColigada and Mae.GRAUPARENTESCO = '7') Left Join Pfdepend Conjuge on (PFunc.Chapa=Conjuge.Chapa and Pfunc.CodColigada=Conjuge.CodColigada and Conjuge.GRAUPARENTESCO = '5') Where Pfunc.CodColigada = '1' Order by Pfunc.Chapa Quote
Juliana Paixão Posted November 8, 2016 Topic Count: 31 Topics Per Day: 0.01 Content Count: 54 Content Per Day: 0.01 Reputation: 0 Achievement Points: 582 Solved Content: 0 Days Won: 0 Status: Offline Age: 36 Author Report Posted November 8, 2016 Obrigada, Jair. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.