1、根据时间查询所有用户最新一条数据
'select user,password,max(date) as date from user group by user'
注意:此处的‘‘user,password’’不能使用“*”号代替,否则会出错(具体原因不明)
2、查询某一用户最新一条数据
'select * from user where user = " ' + userName + ' " order by date desc limit 1'
注意:此处的“userName”是一个变量,一定得注意sql语句中的双引号
3、返回值经过简单的计算
'select (number*3-2)/2 as number from user where user = " ' + userName + ' " order by date desc limit 1'
4、查询某用户在某一时间段所有数据
'select * from user where user = " ' + userName + ' " and date > " ' + startTime + ' " and date < " ' + endTime + ' " '