Bonjour à tous,
Je viens de changer d'hébergeur et mon code n'est plus valable:
Voici mon erreur:
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
Plus exactement voici ce que j'obtiens dans la console:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| FATAL - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
FATAL - at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
FATAL - at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
FATAL - at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
FATAL - at java.lang.reflect.Constructor.newInstance(Unknown Source)
FATAL - at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
FATAL - at com.mysql.jdbc.Util.getInstance(Util.java:384)
FATAL - at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
FATAL - at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
FATAL - at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
FATAL - at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
FATAL - at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
FATAL - at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
FATAL - at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
FATAL - at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)
FATAL - at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
FATAL - at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
FATAL - at com.pforissier.dao.tables.MembresDao.select_groupby(MembresDao.java:386)
FATAL - at com.pforissier.model.CalculSynthese_stocks.<init>(CalculSynthese_stocks.java:63)
FATAL - at com.pforissier.vue.Synthese_stocksPanel$7.actionPerformed(Synthese_stocksPanel.java:351)
FATAL - at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
FATAL - at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
FATAL - at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
FATAL - at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
FATAL - at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
FATAL - at java.awt.Component.processMouseEvent(Unknown Source)
FATAL - at javax.swing.JComponent.processMouseEvent(Unknown Source)
FATAL - at java.awt.Component.processEvent(Unknown Source)
FATAL - at java.awt.Container.processEvent(Unknown Source)
FATAL - at java.awt.Component.dispatchEventImpl(Unknown Source)
FATAL - at java.awt.Container.dispatchEventImpl(Unknown Source)
FATAL - at java.awt.Component.dispatchEvent(Unknown Source)
FATAL - at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
FATAL - at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
FATAL - at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
FATAL - at java.awt.Container.dispatchEventImpl(Unknown Source)
FATAL - at java.awt.Window.dispatchEventImpl(Unknown Source)
FATAL - at java.awt.Component.dispatchEvent(Unknown Source)
FATAL - at java.awt.EventQueue.dispatchEvent(Unknown Source)
FATAL - at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
FATAL - at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
FATAL - at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
FATAL - at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
FATAL - at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
FATAL - at java.awt.EventDispatchThread.run(Unknown Source) |
Voici ma requête "Bato":
SELECT m.id, m.nom, m.prenom, m.passe, SUM(m.solde) AS nombre, m.afficher, m.admin, m.forfait FROM membres m
Plus exactement la méthode concerné:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| public ArrayList<Membres> select_groupby() {
connect= JdbcConnector.getInstance();
try {
try {
prepare = this.connect.prepareStatement(
"SELECT m.id, m.nom, m.prenom, m.passe, SUM(m.solde) AS nombre, m.afficher, m.admin, m.forfait "+
"FROM membres m ");
//On exécute la requête
resultat = prepare.executeQuery();
int i=0;
while(resultat.next()){
table.add(i, new Membres(resultat.getInt("m.id"), resultat.getString("m.nom"), resultat.getString("m.prenom"), resultat.getString("m.passe"),
resultat.getFloat("nombre"), resultat.getInt("m.afficher"), resultat.getInt("m.admin"), resultat.getInt("m.forfait")));
i++;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (resultat != null) {
resultat.close();
}
if (prepare != null) {
prepare.close();
}
if (connect != null) {
connect.close();
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return table;
} |
Merci de m'éclairer sur cette erreur!
Partager