【发布时间】:2023-01-25 20:54:01
【问题描述】:
CREATE TABLE employee
(
joining_date date,
employee_type character varying,
name character varying ,
typeid integer
);
insert into employee VALUES
('2021-08-12','as','hjasghg', 1),
('2021-08-13', 'Rs', 'sa', 1),
('2021-08-14','asktyuk','hjasg', 1),
('2021-09-12','as','hjasghg', 1),
('2021-09-13', 'Rs', 'sa', 1),
('2021-09-14','asktyuk','hjasg', 1),
('2022-08-02','as','hjasghg', 2),
('2022-08-03','as','hjasghg', 2),
('2022-08-04', 'Rs', 'sa', 2),
('2022-08-05','asktyuk','hjasg', 2);
我想获取包含每个月不同 typeid 的第一个数据读数的列。
我试过应用分区,但我似乎无法提取正确的数据。
【问题讨论】:
-
请将您的尝试添加到问题中。还要添加查询的预期结果。
标签: sql postgresql