select DATE_FORMAT(count_date,'%Y-%m') date ,SUM(record_ct)
FROM report r
where DATE_FORMAT(count_date,'%Y-%m')>='2017-07'
And DATE_FORMAT(count_date,'%Y-%m')<='2017-07'
And r.org_id = (Select id from organizations o where o.title = '湖南')
group by DATE_FORMAT(count_date,'%Y-%m')
我要怎么去得到这个date数据 rs.getDate("date")报错 rs.getString("date")无数据 求大神帮帮忙
还有这个数据库语句能优化一下吗
FROM report r
where DATE_FORMAT(count_date,'%Y-%m')>='2017-07'
And DATE_FORMAT(count_date,'%Y-%m')<='2017-07'
And r.org_id = (Select id from organizations o where o.title = '湖南')
group by DATE_FORMAT(count_date,'%Y-%m')
我要怎么去得到这个date数据 rs.getDate("date")报错 rs.getString("date")无数据 求大神帮帮忙
还有这个数据库语句能优化一下吗
count_date between '2017-07-01' and '2017-07-31 23:59:29'
用navicat 能获取数据
在我后台加了这语句
item.setDate(rs.getDate("date"));
它报 Bad format for DATE '2017-06' in column 1.
不加后确实没这个数据,但其它数据能正常显示
所以问题是这条语句为什么让SQL报错