Permalink
Browse files

hard-code columns

  • Loading branch information...
1 parent 4bbbdee commit 10a6c70131388d8494afb1159f0ad981629084d6 @alistairewj alistairewj committed May 25, 2017
Showing with 2 additions and 1 deletion.
  1. +2 −1 tutorials/sql-crosstab.md
@@ -65,7 +65,8 @@ FROM crosstab(
ORDER BY 1,2'
-- below, we list all the unique values in admission_type
-- these will become the columns
- ,'SELECT DISTINCT admission_type FROM admissions ORDER BY 1'
+ -- hard-coding them ensures that the order matches what we specify later
+ ,$$VALUES ('ELECTIVE'::text), ('EMERGENCY'::text), ('NEWBORN'::text), ('URGENT'::text)$$
)
AS ct (
-- first column has each unique value for the rows

0 comments on commit 10a6c70

Please sign in to comment.