sqlite3 日期时间
表:td_log(
有字段:logDate -- 登陆日期;visitpage -- 登陆页面
)如下:
2010-09-29 00:00:04.000 Logon
2010-09-29 00:00:04.000 GetBinaryStream
2010-09-29 00:00:08.000 GetStockJS
2010-09-29 00:00:10.000 GetStockJS
2010-09-29 00:00:10.000 SearchResult
2010-09-29 00:00:13.000 GetUpdateConfig
2010-09-29 00:00:13.000 GetStockJS
2010-09-29 00:00:16.000 GetStockJS
2010-09-29 00:00:16.000 Logon
2010-09-29 00:00:17.000 GetBinaryStream
需要的结果是 每个小时内有哪些访问页面 在小时内访问了多少次?
以下是我在sql server写的代码 但是sqlite3所支持的就不晓得怎么写了。。。求教高手帮忙解答 谢谢!!!
select convert(char(13),logDate,120) as logDate,visitpage,count(visitpage)
from td_log group by visitpage,convert(char(13),logDate,120) order by logDate asc
答案:select substr(logDate,1,13) as logDate,visitpage,count(visitpage)
from td_log
group by visitpage,substr(logDate,1,13)
order by logDate asc
上一个:thinkphp在读取sqlite数据时为什么会出现中文乱码?请高手指点!!
下一个:sqlite数据表的字段有没有数量的限制,如果有是多少