Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 如何编写所需结果的查询_Mysql - Fatal编程技术网

Mysql 如何编写所需结果的查询

Mysql 如何编写所需结果的查询,mysql,Mysql,在我的表格中有4列: id, mobileno(msisdn),type,date 现在我想做一个报告,比如 **date , msisdn , count** 1-oct-2020 , 9999999999 12 1-oct-2020 , 9999999888 10 1-oct-2020 , 9999999666 10 2-oct-2020 , 9999999999 4 2-oct-2020 , 9999999888 30 2-oc

在我的表格中有4列:

id, mobileno(msisdn),type,date
现在我想做一个报告,比如

**date ,         msisdn ,    count**
  
1-oct-2020 , 9999999999    12
1-oct-2020 , 9999999888    10
1-oct-2020 , 9999999666    10

2-oct-2020 , 9999999999    4
2-oct-2020 , 9999999888    30
2-oct-2020 , 9999999666    1
这就是我想要的。 第二份报告如下:

msisdn, unique date()

ex:
msisdn    1oct.  2oct.   3oct   4oct.  5 oct and ............. 31oct
99998877   12 ,  2,       4,     44,     13,    ................ 32
99998874  12 ,  2,       4,     44,     13,    ................ 32
99998875   12 ,  2,       4,     44,     13,    ................ 32

样本数据截图已附加

尝试分组和计数:

选择'date','msisdn',count(1)作为'count`
从`表`
按“日期”分组,`msisdn`
按'date'ASC,'msisdn'ASC订购;

欢迎来到SO。请看我的表格中有4列,以创建表格脚本的形式提供。thnx@mvienhold你能再给我一个查询吗?我需要再找到一个报告,现在我需要msisdn,唯一日期()例如:msisdn 1oct。2行动。10月3日10月4日。10月5日和。。。。。。。。。。。。。1998年10月31日12、2、4、44、13。。。。。。。。。。。。。。。。。。。。32 99998874 12 , 2, 4, 44, 13, .................... 32像this@HouseOfBlogger花点时间读一读:如果你有一个新的要求,你可以问一个新问题。