获取人员及车辆最新抓拍信息
SELECT
t1.c43 AS last_snap_time,
t1.c41 AS face_url,
t1.c42 AS bkg_url,
t1.c40 AS cred_img_url,
t1.c24 AS device_code,
t1.c31 AS device_name,
t1.c19 AS person_type,
t1.c25 AS police_station_name,
t1.c32 AS property_company_phone_number,
t1.c44 AS human_id,
t1.c18 AS cert_num,
t1.c17 AS contact_phone,
t1.c33 AS community_code,
t1.c22 AS community_full_name,
t1.c23 AS region_name,
t1.c26 AS street_road_name,
t1.c20 AS communitee_name,
CURRENT_DATE() AS calc_date
FROM (
SELECT
t1.c43,
t1.c41,
t1.c42,
t1.c40,
t1.c24,
t1.c31,
t1.c19,
t1.c25,
t1.c32,
t1.c44,
t1.c18,
t1.c17,
t1.c33,
t1.c22,
t1.c23,
t1.c26,
t1.c20,
ROW_NUMBER() OVER (PARTITION BY t1.c44 ORDER BY t1.c43 DESC) AS rn
FROM (
SELECT
cred_img_url AS c40,
face_url AS c41,
bkg_url AS c42,
last_snap_time AS c43,
human_id AS c44,
cert_num AS c18,
contact_phone AS c17,
person_type AS c19,
community_code AS c33,
community_full_name AS c22,
region_name AS c23,
communitee_name AS c20,
property_company_phone_number AS c32,
street_road_name AS c26,
device_name AS c31,
device_code AS c24,
police_station_name AS c25
FROM dws_com_person_snap_statistics
UNION ALL
SELECT
plate_no_value AS c34,
last_snap_time AS c35,
plate_color_value AS c36,
plate_url AS c37,
bkg_url AS c38,
cred_img_url AS c39,
device_name AS c5,
person_type AS c6,
device_code AS c4,
cert_num AS c10,
contact_phone AS c11,
community_code AS c12,
community_full_name AS c13,
region_name AS c14,
street_road_name AS c15,
police_station_name AS c7,
property_company_phone_number AS c8,
human_id AS c9,
communitee_name AS c16
FROM dws_com_vehicle_snap_statistics
) t1
) t1
WHERE t1.rn = 1;
原文地址: https://www.cveoy.top/t/topic/oNjK 著作权归作者所有。请勿转载和采集!