Question : This question already has answers here: Return counts for multiple ranges in a single SELECT statement (2 answers) […]
Tag: aggregate-filter
Getting both Having and Not Having in same row
Question : I have a query which I get the customers that have more than 1 orders However, I would […]
Join table into different columns
Question : I have two tables (simplified). table1: – id (serial) table2: – table1_id (integer) – value (text) – type […]
Add aggregated value filtered by a condition to existing query
Question : I have this table to collect data from IoT device: CREATE TABLE public.conferimenti ( id bigint NOT NULL […]
Getting both Having and Not Having in same row
Question : I have a query which I get the customers that have more than 1 orders However, I would […]
Join table into different columns
Question : I have two tables (simplified). table1: – id (serial) table2: – table1_id (integer) – value (text) – type […]
Accumulate values into an array with Postgres
Question : Currently I have this query: select sum(case when my_table.property_type = ‘FLAT’ then my_table.price else 0 end) as Flat_Current_Asking_Price, […]
Improving postgreSQL 13.3 performance on a materialised view?
Question : I found one of our APIs using this query in our materialised view which generates aggregated report on […]
Build a select query that includes aggregated values from a different table
Question : I have two tables in Postgres: polls and votes. The first one polls is designed to contain the […]
Consolidate multiple rows into single row
Question : In PostgreSQL 9.5, I have a table named reports: CREATE TABLE public.reports ( id BIGSERIAL PRIMARY KEY, id_station […]
- 1
- 2