Roman Baths Reversing Sensors

PHOTO EMBED

Sat Dec 03 2022 01:57:44 GMT+0000 (Coordinated Universal Time)

Saved by @seckin #sql

-- INCOUNT - OUTCOUNT

-- 1 - inCount to inCount_1
UPDATE public.metrics_app_timeandgeometric_historic
	SET metric_name= 'inCount_1'
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'inCount'




-- 2 - outCount to inCount
UPDATE public.metrics_app_timeandgeometric_historic
	SET metric_name= 'inCount'
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'outCount'




-- 3 - inCount_1 to outCount
UPDATE public.metrics_app_timeandgeometric_historic
	SET metric_name= 'outCount'
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'inCount_1'



-- INCOUNTTOTAL - OUTCOUNTTOTAL

-- 4 - inCountTotal to inCountTotal_1
UPDATE public.metrics_app_timeandgeometric_historic
	SET metric_name= 'inCountTotal_1'
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'inCountTotal'




-- 5 - outCountTotal to inCountTotal
UPDATE public.metrics_app_timeandgeometric_historic
	SET metric_name= 'inCountTotal'
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'outCountTotal'




-- 6 - inCountTotal_1 to outCountTotal
UPDATE public.metrics_app_timeandgeometric_historic
	SET metric_name= 'outCountTotal'
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'inCountTotal_1'





-- PEOPLECOUNT

-- 7 - peopleCount to peopleCount * -1
UPDATE public.metrics_app_timeandgeometric_historic
	
	--SET metric_name= 'peopleCount'
	SET value = value * -1
	
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'peopleCount'
	



-- 8 - peopleCount to abs(peopleCount)
UPDATE public.metrics_app_timeandgeometric_historic
	
	--SET metric_name= 'peopleCount'
	SET value = abs(value * 1)
	
	WHERE 
	project_name = 'Roman_Baths'
	and geometry_id in (
						2371,
						2375,
						2377,
						2376
						)
	--and time >= '2022-12-02' 
	and time < '2022-12-01'
	and metric_name = 'peopleCount'
	and value = 0
	

	
	
	
	
content_copyCOPY