Skip to content

Instantly share code, notes, and snippets.

@preetamtt
Created April 18, 2018 01:16
Show Gist options
  • Save preetamtt/279a9ca491864739f8579581614221f3 to your computer and use it in GitHub Desktop.
Save preetamtt/279a9ca491864739f8579581614221f3 to your computer and use it in GitHub Desktop.
WITH clicks AS (
SELECT ir.*, service_page_viewed as clicked
FROM `sandbox.ir_ranking_training_ds_apr17_18` ir
INNER JOIN `instant_results.search_results` s ON CAST(ir.service_pk AS INT64) = s.service_pk AND CAST(ir.search_request_pk as INT64) = s.search_request_pk
),
search_atleast_one_conv AS (
SELECT search_request_pk, COUNTIF(one_plus_conversation IS TRUE) as num_conv
FROM clicks
GROUP BY 1
HAVING num_conv > 0
)
SELECT COUNT(DISTINCT search_request_pk) FROM search_atleast_one_conv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment