我需要在同一天的日期之间得到差异,然后得到月份的总和。
通过此查询,我获得实际月份的所有日期(12)
<input #filter (keyup)="filterNodes(filter.value, tree)" placeholder="filter nodes" />
<br/>
<Tree #tree (onMoveNode)="onMoveNode($event)" [focused]="true" [nodes]="nodes" [options]="customTemplateStringOptions">
<!--<Tree [nodes]="nodes">-->
<template #treeNodeTemplate let-node>
<!--<button (click)="af($event)">AF</button>
<button (click)="ab($event)">AB</button>
<button (click)="sf($event)">SF</button>
<button (click)="sb($event)">SB</button> -->
<span><img src="{{node.data.person == '1' ? 'app/user.png' : 'app/catg.png'}}" />{{ node.data.name }}</span>
<!--<button (click)="sb($event)">APPEL</button>
<button (click)="sb($event)">Email</button> -->
</template>
</Tree>**
我认为我必须混合一些mysql查询来获得总数。
使用此查询我可以得到两个日期之间的差异,但我不知道如何使用同一列的数据('fecha')设置开始日期和结束日期
core.umd.js:3491 EXCEPTION: Error in http://localhost:3000/app/tree.component.html:1:0 caused by: self.context.filterNodes is not a function
core.umd.js:3493 ORIGINAL EXCEPTION: self.context.filterNodes is not a function
答案 0 :(得分:1)
select
date_format(dt, '%Y-%m-01') each_months_start,
sec_to_time(sum(secs)) sums_of_secs
from (
select date(fetcha) dt, time_to_sec(timediff(max(fetcha), min(fetcha))) secs
from my_table
group by date(fetcha)
) t
group by
date_format(dt, '%Y-%m-01');