Skip to content

Instantly share code, notes, and snippets.

Michael Discenza mdiscenza

View GitHub Profile
View sample_query_sub_queries.sql
CREATE TEMP TABLE impressions as (
SELECT coalesce(runpid::varchar, run_dev_id_source) uid, min(tstamp) tstamp
FROM
c_f_rat_flat r
LEFT OUTER JOIN
d_xd_src_runpid d
ON r.run_dev_id_source=d.src_id AND r.run_dev_id_type=d.src_id_type
WHERE campaign_id=5147 AND event = 'IMPRESSION' AND tstamp > '2016-08-01 00:00:00' AND src_id_type in ('adGearCookie', 'platformDeviceId')
GROUP BY runpid, run_dev_id_source, txn
)
View sample_query_common_tables.sql
with impressions as (
SELECT coalesce(runpid::varchar, run_dev_id_source) uid, min(tstamp) tstamp
FROM
c_f_rat_flat r
LEFT OUTER JOIN
d_xd_src_runpid d
ON r.run_dev_id_source=d.src_id AND r.run_dev_id_type=d.src_id_type
WHERE campaign_id=5147 AND event = 'IMPRESSION' AND tstamp > '2016-08-01 00:00:00' AND src_id_type in ('adGearCookie', 'platformDeviceId')
GROUP BY runpid, run_dev_id_source, txn
),
You can’t perform that action at this time.