Alrighty, I'm having a problem I cannot for the life of me fix. This is a messy one.
I'm on MySQL5 with innoDB
I have sensor data in multiple tables, all with an ID and a DATETIME field, like so (two tables shown, but there are more). The IDs and DATETIMEs are not identical between tables, as each sensor uploads at a different rate.
temp_data:
INT id
DATETIME ts
FLOAT temp
FLOAT humidity
power_data:
INT id
DATETIME ts
FLOAT lux
FLOAT kW
FLOT volts
My question is: I need to pull all rows within a certain date range from BOTH table- in this case, the last 12 hours, so, the most recent N rows, but in the future, any date range in the past. These will be sorted by the DATETIME value. I've tried every manner of JOIN I'm familiar with but I always get an empty set or an ambiguous column error.
Please help!
Aucun commentaire:
Enregistrer un commentaire