Skip to content
Advertisement

Tag: case

Update SQLite row only if a column is empty

I have the following: one and three should always be updated. However, how can I update two only if it is null/empty? I can do this in a separate command, though how can I achieve this in one prepared statement? I am using SQLite3 Answer Use a CASE expression for column two: Or with COALESCE():

Show a text depending on the value of a column MySQL

I would like to know, how can I build a query that shows me an extra column where instead of showing the true value of the original column it shows me the text that i want? For example, The Column, in this case “inputOutput”, save values ​​0 or 1, and I would like to show in a query that if

Advertisement