使用不同计数时,如何显示多个字段?
我正在尝试使用相同的电子邮件地址获得总数不同的和姓氏的数字,但我不确定从这里去哪里。 field1和field2在同一表中。
我的输出应具有串联字段
,字段1
,field2
SELECT COUNT(DISTINCT(CONCAT(first_name,last_name)))
FROM `datalake.core.profile_snapshot`
WHERE classic_country = 'US' and
email.personal = '[email protected]'
LIMIT 1000
感谢任何帮助!
I am trying to get a count of total different first and last names with the same email address, and I'm not sure where to go from here. Field1 and Field2 are in the same table.
My output should have the concatenated field
, field 1
, field2
SELECT COUNT(DISTINCT(CONCAT(first_name,last_name)))
FROM `datalake.core.profile_snapshot`
WHERE classic_country = 'US' and
email.personal = '[email protected]'
LIMIT 1000
Appreciate any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果要将结果设置减少到特定的电子邮件地址,请添加一个条款即可。
我已经使用了
email_address
而不是email.personal
。If you want to reduce the result set to a particular email address then just add a where clause to do so.
I've used
email_address
instead ofemail.personal
.SQL的限制通常限制返回的行数,而不是用于过滤。 过滤您的聚合电子邮件
需要使用
具有
以用1000多个不同的名称LIMIT for SQL is generally limiting the number of rows returned, not for filtering. Need to use
HAVING
to filter on your aggregateEmail with 1000+ Distinct Names