上图为身份表
依据不同的身份type区分身份,查询usid与gcid身份值相同的数据量:
SELECT COUNT(*)
FROM (
SELECT customer_id
FROM customer_identity
WHERE type IN ('c_usid', 'c_gcid')
AND tenant_id = 1
GROUP BY value, customer_id
HAVING count(1) > 1
) AA
查询有CDMID的客户有多少
SELECT COUNT(value)
FROM customer_identity
WHERE type = 'c_cdmid'
AND tenant_id = 1
网友评论