字段 BETWEEN to_date('2020-12-09','YYYY-MM-DD')AND to_date('2020-12-12','YYYY-MM-DD')
两表合并
SELECTDISTINCTLEFT( j.roomnum, LENGTH ( j.roomnum )-1)AS station,
j.transnum AS transmitterid,(CASE j.transstatus WHEN1THEN1ELSE0END)AS genre,
SUBSTRING ( to_char( j.TIME,'YYYY-MM-DD hh24:mi:ss'),12,5)AS"time",1AS ws
FROM
get_transdata AS j,
xml_push_broadstatuschangereport AS x
WHERE j.TIME>= date_trunc('day',CURRENT_DATE)UNIONALLSELECTDISTINCT
x.station,
x.transmitterid AS transmitterid,(CASE x.genre WHEN1THEN1ELSE0END)AS genre,
SUBSTRING ( to_char( x.startcheckttime,'YYYY-MM-DD hh24:mi:ss'),12,5)ASTIME,2AS ws
FROM xml_push_broadstatuschangereport AS x,
get_transdata AS j
WHERE x.startcheckttime >= date_trunc('day',CURRENT_DATE)ORDERBY"time"DESC