You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SQL新手求助:Campaign表触达渠道评估及双渠道客户统计查询

SQL Queries for Campaign Channel Analysis

Hey there! As a SQL newbie, I’ll walk you through straightforward, easy-to-understand queries to meet your two requirements using your Campaign table.

1. Evaluate Customer Reach Channels

This query breaks down how customers are being reached across each channel, showing the count of unique customers per channel type:

SELECT 
  Channel,
  COUNT(DISTINCT "Customer ID") AS unique_customer_count
FROM Campaign
GROUP BY Channel
ORDER BY unique_customer_count DESC;

Quick breakdown:

  • COUNT(DISTINCT "Customer ID") ensures we count each customer only once per channel, even if they joined multiple campaigns through the same channel.
  • GROUP BY Channel groups results by each of your three channel options (Direct Email, Email, Both).
  • ORDER BY sorts results from the most to least used channel, so you can spot trends at a glance.

2. Count Customers Reached via Both Channels

To get the number of unique customers who were reached through the "Both" channel:

SELECT 
  COUNT(DISTINCT "Customer ID") AS both_channel_customer_count
FROM Campaign
WHERE Channel = 'Both';

Quick breakdown:

  • The WHERE clause filters the table to only include records where the channel is "Both".
  • COUNT(DISTINCT "Customer ID") prevents duplicate counts of the same customer, even if they have multiple campaigns tagged with "Both".

内容的提问来源于stack exchange,提问作者Hitesh Shetty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:37:56