mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +00:00
month param
This commit is contained in:
@ -1,12 +1,12 @@
|
|||||||
WITH params AS (
|
WITH params AS (
|
||||||
SELECT
|
SELECT
|
||||||
TO_DATE(NULLIF($2, ''), 'YYYY-MM-DD') AS event_date,
|
$1::uuid AS space_id,
|
||||||
$4::uuid AS space_id
|
TO_DATE(NULLIF($2, ''), 'YYYY-MM') AS event_month
|
||||||
)
|
)
|
||||||
|
|
||||||
select psdsd.*
|
select psdsd.*
|
||||||
from public."presence-sensor-daily-space-detection" psdsd
|
from public."presence-sensor-daily-space-detection" psdsd
|
||||||
JOIN params P ON true
|
JOIN params P ON true
|
||||||
where psdsd.space_uuid = P.space_id
|
where psdsd.space_uuid = P.space_id
|
||||||
and (P.event_date IS NULL or psdsd.event_date::date = P.event_date)
|
AND (P.event_month IS NULL OR TO_CHAR(psdsd.event_date, 'YYYY-MM') = TO_CHAR(P.event_month, 'YYYY-MM'))
|
||||||
ORDER BY 1,2
|
ORDER BY space_uuid, event_date
|
Reference in New Issue
Block a user