Sorry I couldn’t word this better in the title.
What I have is a table with a column ‘type’ - my records in that table all have one of four possible values for ‘type’ - e.g., type1, type2, type3, or type4. Also, each record has four additional columns: type1, type2, type3, or type4.
Based on what that row’s ‘type’ value is, I want to select the column whose name matches that value.
So, if record id # 314 has a ‘type’ value of ‘type3’, I want to select that record’s value from it’s ‘type3’ column.
I tried something like this, but it doesn’t work of course:
SELECT 'table_name.type' FROM table_name WHERE id='$my_id'
Thanks