I have a table that stores what database should I use for a given device( specified by its IMEI), like this:
imeiDB(
IMEI VARCHAR(15),
db VARCHAR(100));
Let's say I have the database device1(IMEI:123456789123456) is using stored in imeiDB:
123456789123456 | device1db
Supposing I have not selected the database to store the data, how can I select it on the insert into query of my table device1db.table1?
table1(IMEI VARCHAR(15),data VARCHAR(10))
I tried this but it did not work:
INSERT INTO (SELECT db FROM imeiDB where IMEI=123456789123456).table1 (IMEI,data) VALUES (123456789123456,"somestuff")
Any suggestions?