select
a.id AS "id",
a.phone AS "phone",
a.current_temp AS "currentTemp",
a.longitude AS "longitude",
a.latitude AS "latitude",
a.time AS "time"
from ${tableName1} a
where a.phone=#{phone}
union select
b.id AS "id",
b.phone AS "phone",
b.current_temp AS "currentTemp",
b.longitude AS "longitude",
b.latitude AS "latitude",
b.time AS "time"
from ${tableName2} b
where b.phone=#{phone}
union select
c.id AS "id",
c.phone AS "phone",
c.current_temp AS "currentTemp",
c.longitude AS "longitude",
c.latitude AS "latitude",
c.time AS "time"
from ${tableName3} c
where c.phone=#{phone}
ORDER BY time
mysql同时查询多张天表的数据
最新推荐文章于 2022-12-31 19:18:30 发布