SQLite Forum

Timeline
Login

2 forum posts by user melbourne_josh

2021-06-28
11:07 Reply: Am I doing SQL wrong? (artifact: d57f998767 user: melbourne_josh)

Yes, faulty logic on my part. Thank-you!

09:46 Post: Am I doing SQL wrong? (artifact: bcccf771e6 user: melbourne_josh)

SQLite version 3.36.0 2021-06-18 18:36:39 Enter ".help" for usage hints. sqlite> SELECT column1, column2, column3, CASE WHEN column1 > column2 AND column1 < column3 THEN column1 WHEN column2 > column1 AND column2 < column3 THEN column2 WHEN column3 > column1 AND column3 < column2 THEN column3 ELSE -1 END AS only_middle FROM (VALUES (11, 12, 13), (21, 12, 13), (21, 22, 13) );

Expected:

11|12|13|12 21|12|13|13 21|22|13|21

Actual:

11|12|13|12 21|12|13|-1 21|22|13|-1