I have a DB where several Tables are stored like "Item1", "Item2", "Item3" etc. and one Table called "Items".
In "Items" there are all names so you know what sort of values are in the Tables "Item1", "Item2" etc..
Now I like to Select the data from eg. Table "Item2" where all Inside Temperatures are stored. However I like to acces them via the Items table where the ID is stored of the Item Table. See Table Items. The ID for "Temperature Inside" is 2 so I like to get the data from table Item2
So something like this:
SELECT Value AS "Test"
FROM (SELECT concat('Item', ItemId) FROM Items WHERE ItemName = "Temperature Inside")
Table Item2:
time Value
............
1 58
2 67
3 25
6 1
Table Items:
ItemId ItemName
......................
1 "Temperature Outside"
2 "Temperature Inside"
3 "Power"
4 "Voltage"