mercredi 29 juillet 2015

SQLite. SQL. Making row fields into column headings

Tables

tblTracker: [ID, Date]
tblTrackerHours: [tblTracker.ID, Hour]
tblTrackerWTGStatus: [tblTracker.ID, TurbineID, Hour, TurbineStatus]

Desired Output

Columns: Date          | Hour (from tblTrackerHours) | TurbineIDs .....>
Data:    Ordered dates | 1-24 for each date          | TurbineStatus

I'm struggling understand where to begin with creating an SQL statement that will do this. Not every TurbineID has an entry for each hour or each day.

Any hints welcomed :-)

Aucun commentaire:

Enregistrer un commentaire