lundi 6 avril 2015

sqlite extract two row from two tables to create a new table

I have an sqlite db with two table


table1



------------------------------
TIME | ElevationA| ElevationB|
-----|-----------|-----------|
T1 | eA1 | eB1 |
T2 | eA2 | eB2 |


table2



------------------------------
TIME | Temperat A| Temperat B|
-----|-----------|-----------|
T1 | tA1 | tB1 |
T2 | tA2 | tB2 |


I am searching for a "magic" command that make a table of all parameter at a given time, e.g something that would be like:



SELECT WHERE TIME=T1 table1 AS ELEV ,table2 AS TEMP


and that would result in


table3



------------
ELEV | TEMP |
-----|----- |
eA1 | tA1 |
eB1 | tB1 |


Of course I could bash script it but I would prefer a to create a view in SQLite as it is more straightforwards and avoid to duplicate the data. Any idea welcome


Aucun commentaire:

Enregistrer un commentaire