Hello, I have the following 3 tables
Table1
ID | NAME
-----------
1 | X
2 | Y
3 | Z
Table2
ID | NAME
-----------
1 | A
2 | B
3 | C
Table3
ID | P (Boolean field) | Other cols
1 | True ...
2 | True....
1 | False
now I need a query on table3 that has to do the following.
to display the name field of table1 and table2. But my problem is that
if field P on table3 is true i want it to display the name of table2's field where table2.id = table3.id but if it is false i need it to read the name of table1's name field where table1.id = table3.id.
The program which will display the results is a desktop application and i could do it with some procedure or smth to display them, but would be nicer if I had a sql query to do this for me.
Thanks