Я работаю с Grails, и у меня есть этот запрос, который отлично работает, когда я использую MySql, но не работает, когда я использую SQL Server
def list = Ticket.executeQuery("select t.expertice from Ticket t where t.currentStatus = 1 and t.team = 11 group by t.expertice")
The errot I get:
ERROR GrailsExceptionResolver - Column 'expertice.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
com.microsoft.sqlserver.jdbc.SQLServerException: Column 'expertice.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at com.bayer.bbs.emea.web.wbt.TestController$_closure4_closure13.doCall(TestController.groovy:65)
at com.bayer.bbs.emea.web.wbt.TestController$_closure4.doCall(TestController.groovy:29)
at com.bayer.bbs.emea.web.wbt.TestController$_closure4.doCall(TestController.groovy)
at java.lang.Thread.run(Thread.java:662)