troubleshooting Question

MySQL Query dosen't work

Avatar of Qw M
Qw MFlag for United States of America asked on
MySQL Server
3 Comments2 Solutions440 ViewsLast Modified:
Hi,
I need help!
I can't make this query work!

Thank you!


  INSERT INTO temp0 (Cod_COR_functie,Functie,Status,DataAngajarii,TipContract,NumarContract,DurataContract,DataContract,DataExpirareContract,Contract_cu_timp_partial,Repartizare_timp_munca,Casa_de_asigurare,Se_acorda_deduceri,Punct_lucru,PerioadaPreaviz,BancaCard,Cont_card,Tip_act_identitate,Serie,Numar,Eliberat_De,Eliberat_La,Valabil_Pana_La,StareCivila,TelefonPersonal,NumeCopil,NumeCopil_2,DataNastereCopil_2,DataNastereCopil,Adresa_Localitate,Adresa_Judet,Adresa_Strada,Adresa_Numar,Adresa_CodPostal,Adresa_Bloc,Adresa_Scara,Adresa_Etaj,Adresa_Apartament,Adresa_Sector,Activ,LastName,FirstName,CNP,Etaj,Departament,Norma_lucru,Angajator,Profesie,Manager,Proiect,NumarStatie,TelefonServiciu,Email,CardSecuritate,FordelaUserName,SIP,SibcorUserName,Task_I,Task_II,Task_III,Task_altele) (SELECT CNP, max(if(ItemName='CNP', CNP, 0)) AS CNP_init, max(if(ItemName='Cod_COR_functie', DataText, ' ')) AS Cod_COR_functie, max(if(ItemName='Functie', DataText, ' ')) AS Functie, max(if(ItemName='Status', DataText, ' ')) AS Status, max(if(ItemName='DataAngajarii', DataText, ' ')) AS DataAngajarii, max(if(ItemName='TipContract', DataText, ' ')) AS TipContract, max(if(ItemName='NumarContract', DataNumber, 0)) AS NumarContract, max(if(ItemName='DurataContract', DataText, ' ')) AS DurataContract, max(if(ItemName='DataContract', DataText, ' ')) AS DataContract, max(if(ItemName='DataExpirareContract', DataText, ' ')) AS DataExpirareContract, max(if(ItemName='Contract_cu_timp_partial', DataText, ' ')) AS Contract_cu_timp_partial, max(if(ItemName='Repartizare_timp_munca', DataText, ' ')) AS Repartizare_timp_munca, max(if(ItemName='Casa_de_asigurare', DataText, ' ')) AS Casa_de_asigurare, max(if(ItemName='Se_acorda_deduceri', DataText, ' ')) AS Se_acorda_deduceri, max(if(ItemName='Punct_lucru', DataText, ' ')) AS Punct_lucru, max(if(ItemName='PerioadaPreaviz', DataText, ' ')) AS PerioadaPreaviz, max(if(ItemName='BancaCard', DataText, ' ')) AS BancaCard, max(if(ItemName='Cont_card', DataText, ' ')) AS Cont_card, max(if(ItemName='Tip_act_identitate', DataText, ' ')) AS Tip_act_identitate, max(if(ItemName='Serie', DataText, ' ')) AS Serie, max(if(ItemName='Numar', DataNumber, 0)) AS Numar, max(if(ItemName='Eliberat_De', DataText, ' ')) AS Eliberat_De, max(if(ItemName='Eliberat_La', DataText, ' ')) AS Eliberat_La, max(if(ItemName='Valabil_Pana_La', DataText, ' ')) AS Valabil_Pana_La, max(if(ItemName='StareCivila', DataText, ' ')) AS StareCivila, max(if(ItemName='TelefonPersonal', DataNumber, 0)) AS TelefonPersonal, max(if(ItemName='NumeCopil', DataText, ' ')) AS NumeCopil, max(if(ItemName='NumeCopil_2', DataText, ' ')) AS NumeCopil_2, max(if(ItemName='DataNastereCopil_2', DataText, ' ')) AS DataNastereCopil_2, max(if(ItemName='DataNastereCopil', DataText, ' ')) AS DataNastereCopil, max(if(ItemName='Adresa_Localitate', DataText, ' ')) AS Adresa_Localitate, max(if(ItemName='Adresa_Judet', DataText, ' ')) AS Adresa_Judet, max(if(ItemName='Adresa_Strada', DataText, ' ')) AS Adresa_Strada, max(if(ItemName='Adresa_Numar', DataText, ' ')) AS Adresa_Numar, max(if(ItemName='Adresa_CodPostal', DataNumber, 0)) AS Adresa_CodPostal, max(if(ItemName='Adresa_Bloc', DataNumber, 0)) AS Adresa_Bloc, max(if(ItemName='Adresa_Scara', DataText, ' ')) AS Adresa_Scara, max(if(ItemName='Adresa_Etaj', DataNumber, 0)) AS Adresa_Etaj, max(if(ItemName='Adresa_Apartament', DataText, ' ')) AS Adresa_Apartament, max(if(ItemName='Adresa_Sector', DataNumber, 0)) AS Adresa_Sector, max(if(ItemName='Activ', DataText, ' ')) AS Activ, max(if(ItemName='LastName', DataText, ' ')) AS LastName, max(if(ItemName='FirstName', DataText, ' ')) AS FirstName, max(if(ItemName='CNP', DataText, ' ')) AS CNP, max(if(ItemName='Etaj', DataText, ' ')) AS Etaj, max(if(ItemName='Departament', DataText, ' ')) AS Departament, max(if(ItemName='Norma_lucru', DataText, ' ')) AS Norma_lucru, max(if(ItemName='Angajator', DataText, ' ')) AS Angajator, max(if(ItemName='Profesie', DataText, ' ')) AS Profesie, max(if(ItemName='Manager', DataText, ' ')) AS Manager, max(if(ItemName='Proiect', DataText, ' ')) AS Proiect, max(if(ItemName='NumarStatie', DataText, ' ')) AS NumarStatie, max(if(ItemName='TelefonServiciu', DataText, ' ')) AS TelefonServiciu, max(if(ItemName='Email', DataText, ' ')) AS Email, max(if(ItemName='CardSecuritate', DataText, ' ')) AS CardSecuritate, max(if(ItemName='FordelaUserName', DataText, ' ')) AS FordelaUserName, max(if(ItemName='SIP', DataText, ' ')) AS SIP, max(if(ItemName='SibcorUserName', DataText, ' ')) AS SibcorUserName, max(if(ItemName='Task_I', DataText, ' ')) AS Task_I, max(if(ItemName='Task_II', DataText, ' ')) AS Task_II, max(if(ItemName='Task_III', DataText, ' ')) AS Task_III, max(if(ItemName='Task_altele', DataText, ' ')) AS Task_altele FROM tbda_013_empdata GROUP BY CNP ORDER BY LastName ASC) 
ASKER CERTIFIED SOLUTION
DdVar

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros