Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
postgres count gitlab pr &push
SELECT aa.datetime,
aa.cc pushed,
bb.cc pr
FROM (SELECT To_char(created_at, 'YYYY-MM-DD') datetime,
Count (1) cc
FROM EVENTS
WHERE action = 5
AND created_at > NOW() - '30 DAY'::INTERVAL
GROUP BY To_char(created_at, 'YYYY-MM-DD'),
target_type,
action
ORDER BY To_char(created_at, 'YYYY-MM-DD')) aa
left join (SELECT To_char(created_at, 'YYYY-MM-DD') datetime,
Count (1) cc
FROM EVENTS
WHERE target_type = 'MergeRequest'
AND action = 1
AND created_at > NOW() - '30 DAY'::INTERVAL
GROUP BY To_char(created_at, 'YYYY-MM-DD'),
target_type,
action
ORDER BY To_char(created_at, 'YYYY-MM-DD')) bb
ON aa.datetime = bb.datetime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.