You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Results in a query with the same Case When expression multiple times...
SELECTanon_1.season, anon_1.max_snow, anon_1.snow_days, anon_1.max_snwd, anon_1.mean_fluffyFROM (
SELECT season, max_snow, snow_days, max_snwd, mean_fluffy
FROM (
-- first case whenSELECT CASE WHEN (anon_3.month>6) THEN CAST(anon_3.yearASTEXT) ||'-'|| CAST(anon_3.year-1ASTEXT) ELSE CAST(anon_3.year-1ASTEXT) ||'-'|| CAST(anon_3.yearASTEXT) END AS season, max(anon_3.snow) AS max_snow, count(anon_3.snow) AS snow_days, max(anon_3.snwd) AS max_snwd, avg(anon_3.fluffy) AS mean_fluffy
FROM (SELECTdate, snow, snwd, EXTRACT(month FROMsome_table_name.date) AS month, EXTRACT(year FROMsome_table_name.date) AS year, some_table_name.snow/1111AS fluffy
FROM some_table_name) AS anon_3
GROUP BY-- case when repeated
CASE WHEN (anon_3.month>6) THEN CAST(anon_3.yearASTEXT) ||'-'|| CAST(anon_3.year-1ASTEXT) ELSE CAST(anon_3.year-1ASTEXT) ||'-'|| CAST(anon_3.yearASTEXT) END ORDER BY-CASE WHEN (anon_3.month>6) THEN CAST(anon_3.yearASTEXT) ||'-'|| CAST(anon_3.year-1ASTEXT) ELSE CAST(anon_3.year-1ASTEXT) ||'-'|| CAST(anon_3.yearASTEXT) END) AS anon_2) AS anon_1
WHEREanon_1.season='some_season'
The text was updated successfully, but these errors were encountered:
Query now looks like this! (note formatted for ease of reading :)
SELECTanon_1.season,
anon_1.max_snow,
anon_1.snow_days,
anon_1.max_snwd,
anon_1.mean_fluffyFROM (SELECT season,
Max(anon_2.snow) AS max_snow,
Count(anon_2.snow) AS snow_days,
Max(anon_2.snwd) AS max_snwd,
Avg(anon_2.fluffy) AS mean_fluffy
FROM (SELECTDATE,
snow,
snwd,
month,
year,
fluffy,
CASE
WHEN ( anon_3.month>6 ) THEN
Cast(anon_3.yearASTEXT)
||'-'||
Cast(anon_3.year-1ASTEXT)
ELSE Cast(anon_3.year-1ASTEXT)
||'-'|| Cast(anon_3.yearASTEXT)
END AS season
FROM (SELECTDATE,
snow,
snwd,
Extract(month FROMsome_table_name.DATE) AS month
,
Extract(
year FROMsome_table_name.DATE) AS year,
some_table_name.snow/1111AS
fluffy
FROM some_table_name) AS anon_3) AS anon_2
GROUP BY anon_2.season
ORDER BY -anon_2.season) AS anon_1
WHEREanon_1.season='some_season'```
Need to reduce to a simpler example, but this shows the issue.
Results in a query with the same Case When expression multiple times...
The text was updated successfully, but these errors were encountered: