'Converting PostgreSQL into BigQuery including JSON Payload
Can someone help me convert this query which runs on PostgreSQL to something I can run on BigQuery. I can't get my head around the JSON Payload bit
TIA
SELECT
(payload::json->>'duration')::int AS duration,
a.created_at,
a.call_sid,
a.recording,
a.voicemail,
a.custom_conclusion,
a.conclusion,
c.first_name,
c.last_name,
c.phone_number
*/
FROM
event as e
LEFT JOIN
activity as a
ON
a.id = e.activity_id
LEFT JOIN
contact AS c
ON
a.contact_id = c.id
WHERE
subscription_id = ''
AND a.created_at > '2021-01-01 00:00:00.00000'
AND a.created_at < '2022-01-19 23:59:59.00000'
AND a.id IN (
SELECT
activity_id
FROM
event
WHERE
type = 'call_completed')
AND e.type = 'call_completed';`
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
