SELECT
  DATE(submission_timestamp) AS submission_date,
  installer_type,
  `version`,
  funnelcake,
  metadata.isp.name AS isp_name,
  metadata.isp.organization AS isp_organization,
  ping_version,
  attribution.campaign AS attribution_campaign,
  attribution.content AS attribution_content,
  attribution.medium AS attribution_medium,
  attribution.source AS attribution_source,
  attribution.ua AS attribution_ua,
  attribution.dlsource AS attribution_dlsource,
  CASE
    WHEN attribution.dltoken IS NOT NULL
      THEN TRUE
    ELSE FALSE
  END AS has_attribution_dltoken,
  attribution.experiment AS attribution_experiment,
  attribution.variation AS attribution_variation,
  distribution_id,
  metadata.geo.city,
  metadata.geo.country,
  metadata.geo.subdivision1,
  normalized_country_code,
  locale,
  normalized_os,
  os_version,
  build_channel,
  build_id,
  update_channel,
  normalized_channel,
  had_old_install,
  old_default,
  old_version,
  from_msi,
  manual_download,
  silent,
  user_cancelled,
  succeeded,
  profile_cleanup_prompt,
  profile_cleanup_requested,
  new_default,
  new_launched,
  funnel_derived,
  distribution_model,
  partner_org,
  sample_id,
  COUNT(*) AS install_attempts
FROM
  `moz-fx-data-shared-prod.telemetry.install`
WHERE
  DATE(submission_timestamp) = @submission_date
GROUP BY
  DATE(submission_timestamp),
  installer_type,
  `version`,
  funnelcake,
  metadata.isp.name,
  metadata.isp.organization,
  ping_version,
  attribution.campaign,
  attribution.content,
  attribution.medium,
  attribution.source,
  attribution.ua,
  attribution.dlsource,
  CASE
    WHEN attribution.dltoken IS NOT NULL
      THEN TRUE
    ELSE FALSE
  END,
  attribution.experiment,
  attribution.variation,
  distribution_id,
  metadata.geo.city,
  metadata.geo.country,
  metadata.geo.subdivision1,
  normalized_country_code,
  locale,
  normalized_os,
  os_version,
  build_channel,
  build_id,
  update_channel,
  normalized_channel,
  had_old_install,
  old_default,
  old_version,
  from_msi,
  manual_download,
  silent,
  user_cancelled,
  succeeded,
  profile_cleanup_prompt,
  profile_cleanup_requested,
  new_default,
  new_launched,
  funnel_derived,
  distribution_model,
  partner_org,
  sample_id
