2016-11-26 2 views
0

Ich versuche, eine SELECT-Abfrage in SQL in Java (Netbeans) mit Access als SGBD zu tun, aber ich habe einen Fehler Was mache ich falsch? Es sagt Syntaxfehler in FROM. Was wirklich merkwürdig ist, ist, dass die Abfrage in Access gut funktioniert und andere (einfachere) Abfragen im Java-Skript korrekt implementiert wurden. Ich habe in den Büchern, die ich gekauft habe oder sogar im Internet, keinen Doc gefunden, weil es oft weniger Tische hat! Vielen Dank im Voraus -SQL auf Java (Abfrage)

PreparedStatement ps = cnx.prepareStatement("SELECT Client.Nom , Facture.Date_Achat , Client.Prénom , Facture.N°Fac , SUM(Contient1.Quantité1*PrixAchatMonture)AS Somme "+ 
"FROM Facture , Client , Contient1 , Monture "+ 
"ON Facture.N°Client=Client.N°Client AND Facture.N°Fac=Contient1.N°Fac AND Contient1.IDM=Monture.IDM "+ 
"WHERE Client.Nom =? AND Client.Prénom=? "+ 
"GROUP BY Client.Nom, Facture.Date_Achat, Client.Prénom, Facture.N°Fac",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); 
     // ! au sens de la jointure pour l'affichage 

[Microsoft] [ODBC Microsoft Access Pilote] Syntaxfehler in der Von

Antwort

0

ich denke, es

PreparedStatement ps = cnx.prepareStatement("SELECT Client.Nom , Facture.Date_Achat , Client.Prénom , Facture.N°Fac , SUM(Contient1.Quantité1 * Monture.PrixAchatMonture) AS Somme "+ 
"FROM Facture , Client , Contient1 , Monture "+ 
"ON Facture.N°Client=Client.N°Client AND Facture.N°Fac=Contient1.N°Fac AND Contient1.IDM=Monture.IDM "+ 
"WHERE Client.Nom =? AND Client.Prénom=? "+ 
"GROUP BY Client.Nom, Facture.Date_Achat, Client.Prénom, Facture.N°Fac",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); 
+0

PreparedStatement ps = cnx.prepareStatement sein sollte ("SELECT Client.Nom, Facture.Date_Achat, Client.Prénom, Facture.N ° Fac, SUM (Contient1.Quantité1 * Monture.PrixAchatMonture) AS Somme" + "FROM Facture" + "INNER JOIN Client ON Facture.N ° Client = Client.N ° Client" + "INNERER VERBINDUNGSMITTEL Conti1 ON Fact.N ° Fac = Contient1.N ° Fac" + "INNERER VERBINDER Monture ON Contient1.IDM = Monture. IDM "+ " WHERE Client.Nom =? AND Client.Prénom =? "+ " GROUP BY Client.Nom, Facture.Date_Achat, Client.Prénom, Facture.N ° Fac ", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); –

+0

Es funktioniert nicht –