Requete MySQL sur plusieurs tables avec des group by et join...: ma String query

Résolu
tomski Messages postés 48 Date d'inscription mercredi 24 mars 2004 Statut Membre Dernière intervention 24 décembre 2009 - 21 juil. 2009 à 12:00
tomski Messages postés 48 Date d'inscription mercredi 24 mars 2004 Statut Membre Dernière intervention 24 décembre 2009 - 23 juil. 2009 à 15:06
Bonjour a tous!

Je me connecte a mysql sans probleme, j'arrive a effectuer des requetes simples "select champs1 from matable", par contre la requete que je dois lancer evidemment ne fonctionne pas dans Java (mais bien dans mysql!!).

Apparemment ce serait ma String qui serait trop grande, et on dirait que java n'accepte pas le "." dans ma requete. (OT.codeproduit....)

Erreurs lancées: "; expected" et "Not a Statement"

quelquun a une idee?
Merci beaucoup pour votre aide



ci dessous le contenu de ma String query.

select ot.code_codeot,etat_ot.codeetatot etat, OT.CodeActivite AS Activite, OT.CodeProduit AS Produit,OT.UI UI, LI.ND AS ND, ifNull(OT.OrigineSignalisation,' ') AS Origine,(Select ifNull((Select AD2.LibelleCommune From Ligne L2 Join Adresse AD2 On L2.EquipementID AD2.EquipementID Where L2.LigneID LI.LigneID), ' ')) AS Lieu, (select ifnull((select if(nom_utilisateur='',nom_titulaire,nom_utilisateur)from abonne AB where AB.equipementid=LI.equipementid ),' ')) as abonne, EQ.LibelleEquipe AS Equipe, DivProd.nomdivisionproduction as Societe,
(Select ifNull((Select Date(OT2.DateHeureRdvEffectif)From Code_OT OT2 Where OT2.Code_CodeOT OT.Code_CodeOT),' ')) AS planifie, (Select ifNull((Select OT2.DateHeureContractuelle From Code_OT OT2 Where OT2.Code_CodeOT OT.Code_CodeOT),' ')) AS contrat,
(Select ifNull((Select Date(OT2.DateHeureTest) From Code_OT OT2 Where OT2.Code_CodeOT OT.Code_CodeOT),' ')) AS debut,(Select ifNull((Select Date(OT2.DateHeureCloture) From Code_OT OT2 Where OT2.Code_CodeOT OT.Code_CodeOT),' ')) AS Fin,(Select ifNull((Select RI2.CodeResultatIntervention From Asso_Ligne_Resultat_Intervention ALRI2 Join Resultat_Intervention RI2 On ALRI2.ResultatInterventionID = RI2.ResultatInterventionID Where ALRI2.LigneID = LI.LigneID), ' ')) AS Resultat_Intervention, (Select ifNull((Select ER2.LibelleEssaiRobot From Asso_Ligne_Resultat_Intervention ALRI2
Join Essai_Robot ER2 On ALRI2.EssaiRobotID ER2.EssaiRobotID Where ALRI2.LigneID LI.LigneID), ' ')) AS Essais, (Select if(OT2.Facture is Null or OT2.Facture = 0, 'N', 'O') From Code_OT OT2 Where OT2.Code_CodeOT = OT.Code_CodeOT ) AS Facturation, (Select ifNull((Select sum(NA.QuantiteAction) From Necessiter_Action NA Where NA.LigneID = LI.LigneID And NA.CodeActionOT = 20), ' ')
) AS Pose_DTI, (Select ifNull((Group_Concat((Select (if((MU2.AncTete Like '%%%-%%-%%%'), Concat(MU2.AncTete, '\n', 'N DECH ', MU2.CodeDecharge), Concat(MU2.NouvTete, '/', MU2.NouvAmorce, '/', MU2.NouvPaire, '\n', 'N DECH ', MU2.CodeDecharge)))
From Mutation MU2 Where MU2.MutationID ALM.MutationID) SEPARATOR '\n')), ' ') From Ligne LI2 Left Join Asso_Ligne_Mutation ALM On LI2.LigneID ALM.LigneID Where LI2.LigneID = LI.LigneID ) AS New_Const_Comment, OT.CommentaireInterne AS Comment, (select ifnull(( select pc.codecategoriepc from asso_ligne_architecture,pc where asso_ligne_architecture.equipementid=pc.equipementid and asso_ligne_architecture.ligneid=LI.ligneid),' ')) AS CategoriePC, (select ifnull((
select libellequalificatif from qualifie_OT join qualificatif on ( qualificatif.codequalificatif=qualifie_OT.codequalificatif) where (qualificatif.codequalificatif=5 or qualificatif.codequalificatif=6) and qualifie_OT.code_codeot=ot.code_codeot),' ')) as Travail, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'BRA' And ALA2.LigneID = LI.LigneID), '')) AS BRA, (Select ifNull((Select ALA2.QuantiteArticle
From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID AR2.ArticleID Where AR2.CodeArticle 'BRI' And ALA2.LigneID = LI.LigneID), '')) AS BRI, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2
Join Article AR2 On ALA2.ArticleID AR2.ArticleID Where AR2.CodeArticle 'BRF' And ALA2.LigneID = LI.LigneID), '')) AS BRF, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID
Where AR2.CodeArticle 'BRS' And ALA2.LigneID LI.LigneID), '')) AS BRS, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'MIT' And ALA2.LigneID = LI.LigneID), '')) AS MIT, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'PDF' And ALA2.LigneID = LI.LigneID), '')) AS PDF,(Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'RDS' And ALA2.LigneID = LI.LigneID), '')) AS RDS, (Select ifNull((Select ALA2.QuantiteArticle
From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID AR2.ArticleID Where AR2.CodeArticle 'RSTH' And ALA2.LigneID = LI.LigneID), '')) AS RSTH, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'BSR' And ALA2.LigneID = LI.LigneID), '')) AS BSR,
(Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID AR2.ArticleID Where AR2.CodeArticle 'JRT' And ALA2.LigneID = LI.LigneID), '')) AS JRT, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'JRTM' And ALA2.LigneID = LI.LigneID), '')) AS JRTM, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'RNU' And ALA2.LigneID = LI.LigneID), '')) AS RNU, (Select ifNull((Select ALA2.QuantiteArticle
From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID AR2.ArticleID Where AR2.CodeArticle 'HIC' And ALA2.LigneID = LI.LigneID), '')) AS HIC, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'GTR' And ALA2.LigneID = LI.LigneID), '')) AS GTR, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'LAN' And ALA2.LigneID = LI.LigneID), '')) AS LAN, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'NET' And ALA2.LigneID = LI.LigneID), '')) AS NET, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'PCM' And ALA2.LigneID = LI.LigneID), '')) AS PCM, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'RDM' And ALA2.LigneID = LI.LigneID), '')) AS RDM, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'AMS' And ALA2.LigneID = LI.LigneID), '')) AS AMS, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'MPSR' And ALA2.LigneID = LI.LigneID), '')) AS MPSR, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'MPREJ' And ALA2.LigneID = LI.LigneID), '')) AS MPREJ, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'MPREN' And ALA2.LigneID = LI.LigneID), '')) AS MPREN, (Select ifNull((Select ALA2.QuantiteArticle From Asso_Ligne_Article ALA2 Join Article AR2 On ALA2.ArticleID = AR2.ArticleID Where AR2.CodeArticle = 'PCX' And ALA2.LigneID = LI.LigneID), '')) AS PCX from code_ot ot Join Asso_OT_ND AON On OT.Code_CodeOT = AON.Code_CodeOT Join Ligne LI On AON.LigneID = LI.LigneID Left Join Adresse AD On LI.EquipementID = AD.EquipementID Left Join Asso_Ligne_Resultat_Intervention ALRI On LI.LigneID = ALRI.LigneID Left Join Resultat_Intervention RI On ALRI.ResultatInterventionID = RI.ResultatInterventionID
Left Join Essai_Robot ER On ALRI.EssaiRobotID ER.EssaiRobotID left Join OT_EQP_Planning OEP On OT.Code_CodeOT OEP.Code_CodeOT left Join Equipe EQ On OEP.CodeEquipe = EQ.CodeEquipe left join DivProd DivProd on (divprod.codedivisionproduction=EQ.codedivisionproduction) join etat_OT on (ot.etatotid=etat_ot.etatotid)



(_.:~:._)
A voir également:

2 réponses

tomski Messages postés 48 Date d'inscription mercredi 24 mars 2004 Statut Membre Dernière intervention 24 décembre 2009
23 juil. 2009 à 15:06
C bon jai trouvé: jai viré tous les espaces, ca marche nickel.
je cherche toujours comment recuperer les noms des colonnes (getColumnName) mais ca marche po!
Jfinirai bien par trouver.

Merci a tous ceux ki ont repondu

(_.:~:._)
3
kirua12 Messages postés 1155 Date d'inscription samedi 17 janvier 2004 Statut Membre Dernière intervention 29 avril 2011 7
21 juil. 2009 à 14:02
Salut,

c'est une erreur de compil ou d'exécution ? tu peux nous montrer ton code et la stacktrace ?
0
Rejoignez-nous