做了一个sqlserver 分组查询的 sqlQuery,老是报
java.lang.NumberFormatException: For input string:"2013-12-12",
原代码是:
Query query1 = session.createSQLQuery("select CONVERT(varchar(100), _t1010.tf_createdate , 23) , count(*) from Global _t1010 "groupby CONVERT(varchar(100), _t1010.tf_createdate , 23)");List<?> results = query1.list();
老是报类型转换错 ,后来改成这样就好了:
.createSQLQuery("select CONVERT(varchar(100), _t1010.tf_createdate , 23) as id , count(*) as count from Global _t1010 " group by CONVERT(varchar(100), _t1010.tf_createdate , 23)");
加上二个as 就可以了,很奇怪的问题