Skip to content

Instantly share code, notes, and snippets.

@cnstlungu
Last active November 5, 2022 21:46
Show Gist options
  • Save cnstlungu/eb6d68314f7a799fd781933a991c83ca to your computer and use it in GitHub Desktop.
Save cnstlungu/eb6d68314f7a799fd781933a991c83ca to your computer and use it in GitHub Desktop.
Use consistent indentantion
SELECT
column1,
column2,
CASE
WHEN column2 = 'event' THEN TRUE
ELSE FALSE
END AS is_event,
SUM(column3) AS total_value
FROM
table1 t1
JOIN
table2 t2 ON t1.column1 = t2.column2
GROUP BY
t1.column1, t2.column2
ORDER BY
column1, column2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment