I'm not sure this is possible with just SQL...any help will be appreciated:
I'm trying to retrieve a value in a column in table B (tblProduct). The column name is actually defined in reference table A (tblConfig_Group).
So, essentially, I'm given the tblConfig_Group.groupCode and tblProduct.VCI values
I need to retrieve the value in the appropriate column in tblProduct set in dbColumnUK.
tblConfig_Group:
+----+-----------+-------------+
| id | groupCode | dbColumnUK |
+----+-----------+-------------+
| 01 | A | WindowGBP_A |
| 02 | B | WindowGBP_B |
| 03 | C | WindowGBP_C |
| 04 | D | WindowGBP_D |
+----+-----------+-------------+
tblProduct:
+----+---------+-------------+-------------+-------------+-------------+
| id | VCI | WindowGBP_A | WindowGBP_B | WindowGBP_C | WindowGBP_D |
+----+---------+-------------+-------------+-------------+-------------+
| 01 | vci1 | 1 | 11 | 21 | 31 |
| 02 | vci2 | 2 | 12 | 22 | 32 |
| 03 | vci3 | 3 | 13 | 23 | 33 |
| 04 | vci4 | 4 | 14 | 24 | 34 |
+----+---------+-------------+-------------+-------------+-------------+
Aucun commentaire:
Enregistrer un commentaire