我有一张包含以下信息的表格
我想显示一些类似的信息
实际上我正在使用php来显示一个谷歌图表,我需要一个查询,它可以给我这个输出。系统应该检查月份,并根据它应该准备报告的月份,例如,如果4月份它应该显示4月A和B用户为零。我正在使用以下查询,但它
SELECT name
,month as month
,count(*) as no_of_vists
FROM abc where name = 'A'
group by month
order by date(month);
答案 0 :(得分:1)
尝试如下:
_onItemClick: function() {
this.$.f_view.data = this.$.l_view.selected;//or any attribute of the selected item
this.$.pages.selected = 1;
},
输出:
select x.name
,x.month
,count (y.*)
FROM
(SELECT b.name
,a.month
FROM (select month from abc) a
JOIN (select name from abc) b
ON (1=1)
group by 1,2 ) x
LEFT JOIN abc y
ON (x.month = y.month and x.name = y.name)
group by 1,2
order by 1,2;
这是sqlfiddle:http://sqlfiddle.com/#!15/3feb0/24