 
 		case .unary(let unary, let ex):
 			return unary.sql(expression: ex.sql(dialect: dialect), dialect: dialect)
+
+		case .when(let whens, else: let elseOutcome):
+			let whensString = whens.map { w in
+				return " WHEN \(w.when.sql(dialect: dialect)) THEN \(w.then.sql(dialect: dialect))"
+			}.joined()
+
+			let elseString: String
+			if let e = elseOutcome {
+				elseString = " ELSE \(e.sql(dialect: dialect))"
+			}
+			else {
+				elseString = ""
+			}
+
+			return "CASE\(whensString)\(elseString) END"
 		}
 	}
 }

			self.stack.append(.expression(.binary(left, op, right)))
		})/~)

		add_named_rule("ex", rule: ^"ex-equality")

		add_named_rule("order-direction", rule:
			(Parser.matchLiteralInsensitive("ASC") => {


		case .unary(let unary, let ex):
			newSelf = .unary(try unary.visit(visitor), try ex.visit(visitor))

		case .when(let whens, else: let e):
			newSelf = .when(try whens.map {
				return SQLWhen(when: try $0.when.visit(visitor), then: try $0.then.visit(visitor))
			}, else: try e?.visit(visitor))
		}

		return try visitor.visit(expression: newSelf)
