SnippetLibrary

NameTagsSQL
ansi
(select {{group_by_col}}, max({{max_col}}) max_{{max_col}} from {{table}} group by 1) as max_{{table}}
postgres
date_trunc('day', {{column_name}})::date::text as "{{alias}}_day", date_trunc('week', {{column_name}})::date::text as "{{alias}}_week", date_trunc('month', {{column_name}})::date::text as "{{alias}}_month"
postgres
with {{alias}} as ( select from {{table_name}} )
Days between two dates
postgres
now()::date - some_date::date