jeudi 26 novembre 2015

SQLite 3 JOINS across 3 Tables

I am very new to SQLite3 and trying to get my head around using different JOINS across multiple tables to get an output table of monitor voltages for a data logging system I am working on.

I have data in three tables -

"Channels" : name | channelId (primary key auto increment)

"Times": time (ISO Text format)| timeId (primary key auto increment)

"Voltages": monitorVoltage | channelId | timeId

What I would ultimately like to produce is a table to display to the user or export to a .csv file which looks like this

channel name, time 1, time 2,time 4,
channel 0    ,   0.1  ,  2     ,  2.1,
channel 1    ,   0.5  ,  5     ,  10 ,
channel 2    ,   0.7  ,  5     ,  10 ,

for time values in a given range and with channel names that match a LIKE condition.

I think that I would start:

SELECT Channels.name Times.time Voltages.monitorVoltage FROM Voltages

But after that I am lost.

Any help/suggestions would be much appreciated.

Cheers

John

Aucun commentaire:

Enregistrer un commentaire