I am having trouble joining 2 tables.
Table Names: QUESTION ANSWER
QUESTION Table contains a column with column name as ANSWER_LOCATION and it is INT data type. This column contains number of rows with values (1, 2, 3, 4 ...) and these numbers are column names in ANSWER table.
select QUESTION.ANSWER_LOCATION from QUESTION where ID = 5
The output of this query will be 5 (scalar value) and I need to join value (5) with ANSWER table to select the COLUMN5.
Please let me know if I need to provide more information.
Thanks in anticipation.
asked Mar 24 '10 at 04:38 PM in Default
However, you should really consider re-designing this data set, such that you have the same value in the ANSWER table, then you can enforce referential integrity with foreign keys etc. It would be worth posting the DDL in a separate question titled something along the lines of 'how should I re-design these tables'.
answered Mar 24 '10 at 05:58 PM
Matt Whitfield ♦♦