Programming, Alibaba Cloud, Database, Postgresql, Data Analytics.
select random()*100000, clock_timestamp(), random() from generate_series(1,100000000); Use a subquery to query the last VALUE of each sensor ID. select (t.b).aid,(t.b).val,(t.b).crt_time from ( select (select b from b where b.aid=a.id order by crt_time desc limit 1) -- sub query,