SELECT a.time,COALESCE(b.counts,0) as counts from
(
SELECT
to_char ( b, 'YYYY-MM-DD' ) AS time
FROM
generate_series ( to_timestamp ( '2024-06-01', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( '2024-06-30', 'YYYY-MM-DD hh24:mi:ss' ), '1 days' ) AS b
GROUP BY
time ORDER BY time asc
) as a
FULL OUTER JOIN
(
select to_char(to_timestamp(create_time/1000)::TIMESTAMP, 'YYYY-MM-DD' ) AS starttime, count(*) as counts from t_work_order GROUP BY starttime
) as b
on a.time=b.starttime
WHERE time is not null
order by a.time asc
2.按照月
SELECT a.time,COALESCE(b.counts,0) as counts from
(
SELECT
to_char ( b, 'YYYY-MM' ) AS time
FROM
generate_series ( to_timestamp ( '2024-01-01', 'YYYY-MM' ), to_timestamp ( '2024-06-30', 'YYYY-MM' ), '1 months' ) AS b
GROUP BY
time ORDER BY time asc
) as a
FULL OUTER JOIN
(
select to_char(to_timestamp(create_time/1000)::TIMESTAMP, 'YYYY-MM' ) AS starttime, count(*) as counts from t_work_order GROUP BY starttime
) as b
on a.time=b.starttime
WHERE time is not null
order by a.time asc
3.按照年
SELECT a.time,COALESCE(b.counts,0) as counts from
(
SELECT
to_char ( b, 'YYYY' ) AS time
FROM
generate_series ( to_timestamp ( '2022-01-01', 'YYYY' ), to_timestamp ( '2024-06-30', 'YYYY' ), '1 years' ) AS b
GROUP BY
time ORDER BY time asc
) as a
FULL OUTER JOIN
(
select to_char(to_timestamp(create_time/1000)::TIMESTAMP, 'YYYY' ) AS starttime, count(*) as counts from t_work_order GROUP BY starttime
) as b
on a.time=b.starttime
order by a.time asc
g o l a n g golang golang的 s t r i n g string string类型是不可修改的,对于拼接字符串来说,本质上还是创建一个新的对象将数据放进去。主要有以下几种拼接方式
拼接方式介绍
1.使用 s t r i n g string string自带的运算符
ans ans s2. 使用…
Media Kit 特点
一般场合的音视频处理,可以直接使用系统集成的Video组件,不过外观和功能自定义程度低Media kit:轻量媒体引擎,系统资源占用低支持音视频播放/录制,pipeline灵活拼装,插件化扩展source/demu…
实测工程量值(变送器量程最大值-变送器量程最小值)/(数字量最大值-数字量最小值)*(当前采集工程量值-零点误差值)。
相关程序代码
SEAL_PRESSURE.h class CSEAL_PRESSUREApp : public CWinApp
{
public:C…