我有5张桌子:
值(温度,按和嗡嗡声)来自ESP32,并且将以相同的时间值插入到2,3和4中。
我想显示按日期排序的值,仅播出1.date_time,2.value作为温度,3.value作为湿度,4.value作为压力和5.name,而不显示5.location和5.sensor_config 到此为止,但是如何在左边的联接表上使用别名?
这是我使用的查询:
SELECT * FROM date_time as t
left join temperature as temp on t.ID = temp.id_date_time
left JOIN humidity as hum on t.ID = hum.id_date_time
left join pressure as press on t.ID = press.id_date_time
left join esp_list as esp on temp.ID_ESP = esp.ID
where hum.ID_ESP = 1 AND temp.ID_ESP = 1 AND press.ID_ESP = 1
order by t.date_time DESC
到目前为止,这是我的收获:
答案 0 :(得分:0)
将SELECT *
更改为
SELECT t.date_time, temp.value AS temperature, hum.value AS humidity, press.value AS pressure, esp.name