先直接來看例子
create table gals1 (
id int generated always as identity primary key
, name text not null unique
);
insert into gals1 (name)
values ('小島南')
returning *;
Hitomi Tanaka changed 2 months agoView mode Like Bookmark
前言
在之前的一些分享中,有一些關於直轉橫的方式,也有固定時段與不固定時段的統計方式.
這篇會對直轉橫統計及統計後直轉橫做一些探討.
直接統計的傳統方式
測試資料
create table t231122a (
id int not null generated always as identity primary key
, gal text
, dt date
Hitomi Tanaka changed a year agoView mode Like 2 Bookmark
這是延伸的問題,之前有固定間隔的,也介紹了date_bin().
上一次的
這次的
苦工大師
with t1 as (
select case
when ts >= timestamp '2023-10-11 09:00:00'
and ts < timestamp '2023-10-11 10:00:00'
then timestamp '2023-10-11 09:00:00'
Hitomi Tanaka changed a year agoView mode Like Bookmark