Skip to content
Advertisement

Tag: case

Multiple WHEN in CASE only applies first two

I have a CASE with 4 WHENs. The first two applie fine, but the last two (or any others I add past that) do not get applied. All WHENs are referring to the same field. Here’s what I’m trying to do. The field in question is formatted as: So it would look like The first Case I wrote was to

Update column with below query?

How do I write this query to update a column based on the case statement? Answer As commented, you query looks pretty good, apart from these: the ORDER BY clause does not make sense; an UPDATE query does not return any record, so ordering is out of scope for the same reason, you don’t have to alias the updated column

Advertisement