I have 3 tables, lets say tables A, B, C to obfuscate my software :). A and B have two columns with numeric values and Table C has a Boolean column.
What I want is to create a view with a single column where depending on the column in C, either the value in A or B is selected.
Example:
Input:
| A.val | | B.val | | C.val |
--------- --------- ---------
entry1 | 1 | | 6 | | T |
entry2 | 2 | | 8 | | F |
Output:
| D |
-----
entry1 | 1 |
entry2 | 8 |
I'm wondering if there is a way to do this in a SQL statement(s) since I am currently doing it programmatically which eats up unnecessary resources.