Super Richman
03/10/2023, 8:21 AMSELECT (SUM(AVG(visMiles))) FROM weather
Bolek Ziobrowski
03/10/2023, 8:28 AMSuper Richman
03/10/2023, 8:37 AMMiguel Arregui
03/10/2023, 8:46 AMCREATE TABLE tax (
ts TIMESTAMP,
concept SYMBOL,
amount FLOAT
) TIMESTAMP(ts) PARTITION BY YEAR;
SELECT ss.ts, irpf.sum irpf, ss.sum ss, irpf.sum + ss.sum total
FROM
(SELECT ts, concept, sum(amount) FROM tax
WHERE concept='Pago de impuestos' AND year(ts) = 2022
SAMPLE BY 3M ALIGN TO CALENDAR) irpf
ASOF JOIN
(SELECT ts, concept, sum(amount) FROM tax
WHERE concept='Cargo cuota SS' AND year(ts) = 2022
SAMPLE BY 3M ALIGN TO CALENDAR) ss
WITH taxes_by_quarter AS (
SELECT ss.ts, irpf.sum irpf, ss.sum ss, irpf.sum + ss.sum total
FROM
(SELECT ts, concept, sum(amount) FROM tax
WHERE concept='Pago de impuestos' AND year(ts) = 2022
SAMPLE BY 3M ALIGN TO CALENDAR) irpf
ASOF JOIN
(SELECT ts, concept, sum(amount) FROM tax
WHERE concept='Cargo cuota SS' AND year(ts) = 2022
SAMPLE BY 3M ALIGN TO CALENDAR) ss)
SELECT sum(irpf), sum(ss), sum(total) FROM taxes_by_quarter;
Super Richman
03/10/2023, 9:11 AMSELECT cloudCeiling + AVG(visMiles) FROM weather
javier ramirez
03/10/2023, 9:26 AMSELECT cloudCeiling, cloudCeiling + AVG(visMiles) FROM weather
order by cloudCeiling
SELECT cloudCeiling, cloudCeiling + AVG(visMiles) FROM weather
group by cloudCeiling order by cloudCeiling
SELECT cloudCeiling, AVG(visMiles) as local_average, cloudCeiling + AVG(visMiles) as total FROM weather
group by cloudCeiling order by cloudCeiling
WITH total_average AS (
SELECT AVG(visMiles) as total_average FROM weather
)
SELECT cloudCeiling, total_average, cloudCeiling + total_average as total FROM weather
cross join total_average
Bolek Ziobrowski
03/10/2023, 10:27 AMSuper Richman
03/10/2023, 3:26 PM