dpz90118 2013-04-17 05:50
浏览 4
已采纳

图形显示的数据收集(SQL)

What's the post efficient way to load data from database to generate report.

For example, if i want to have a graph of how many people sign up per day.

Information i would need is

Day 1 - > Amount users
Day 2 - > Amount users
Day 3 - > Amount users
Day 4 - > Amount users
Day 5 - > Amount users
Day 6 - > Amount users

But if its a 30 days, it would be 30 SQL query in my eyes, which i don't think its very efficient.

having MySQL query and then keep fetch out the result.

Is there a way you can doing this better and efficient to go about this? Thanks for any suggestion.

Table structure is simple:

id
username
password
salt
create_date
edit_date
  • 写回答

2条回答 默认 最新

  • doudun3040 2013-04-17 06:05
    关注

    This should work :

    select count(distinct id) as amount
    from users
    group by year(create_date),month(create_date),day(create_date)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?