Skip to content

Instantly share code, notes, and snippets.

@5outh
Created September 22, 2017 17:57
Show Gist options
  • Save 5outh/839a129cd525b4a7b79f2755046ba4ba to your computer and use it in GitHub Desktop.
Save 5outh/839a129cd525b4a7b79f2755046ba4ba to your computer and use it in GitHub Desktop.
select (
ident || 'StandardCode :: StandardCode' || E'\n' || ident || 'StandardCode = "' || standard_code || '"' || E'\n' || E'\n' ||
ident || 'StandardId :: StandardId' || E'\n' || ident || 'StandardId = StandardKey "' || standard_id || '"' || E'\n'
) FROM
(select
(case when school_grade=1 then 'one'
when school_grade=2 then 'two'
when school_grade=3 then 'three'
when school_grade=4 then 'four'
when school_grade=5 then 'five'
when school_grade=6 then 'six'
when school_grade=7 then 'seven'
when school_grade=8 then 'eight'
when school_grade=9 then 'nine'
when school_grade=0 then 'k'
else 'N/A' end) || initcap(domain_abbreviation) || suffix as ident,
school_grade::text || '.' || domain_abbreviation || '.' || suffix as standard_code,
id as standard_id
from standards) s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment