gpt4 book ai didi

php - Mysql只选择唯一行(只出现一次)

转载 作者:行者123 更新时间:2023-11-29 04:35:42 24 4
gpt4 key购买 nike

考虑表中的以下数据 ->

1   example@hotmail.com
2 example12@hotmail.com
3 example@hotmail.com
4 example@hotmail.com

我希望它只返回以下内容:

2   example12@hotmail.com

...并跳过重复值。

最佳答案

你要查询的是

SELECT id, email, whatEverColumn 
FROM table
WHERE email IN (SELECT email
FROM table
GROUP BY email
HAVING COUNT(id) = 1)

关于php - Mysql只选择唯一行(只出现一次),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42568060/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com