I have 3 tables, I need advice on how to get data from them.
Table name
details_varchar
details_int
details_date
each of them have value_id[Int] and value_name [value_name type varies as per table name - Varchar, Int, Date]
Conditions
- only one unique
value_idwill be present in any one of the 3 tables. i.e ID from 1 to n are stored in these tables according to their Data Types. If value_id = 1 and value_name[type] = int then it stores in details_int table.
What I need
select value_name from 3 tables[may appear in any one of the table] where value_id = '[I have this value stored in a variable]'
What I tried
UNION - but all the table needs to have same column type.
JOINS - All the fields should be connected.[I guess]