Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
如何查询 MySQL 中 refund_id 相同且 return_code 为 SUCCESS 的记录,并筛选出 return_code=SUCCESS 出现次数大于或等于 2 的记录?_创想鸟

如何查询 MySQL 中 refund_id 相同且 return_code 为 SUCCESS 的记录,并筛选出 return_code=SUCCESS 出现次数大于或等于 2 的记录?

如何查询 mysql 中 refund_id 相同且 return_code 为 success 的记录,并筛选出 return_code=success 出现次数大于或等于 2 的记录?

mysql 查询两个字段特定值且重复记录

如何查询 refund_id 相同,且 return_codesuccess 的记录,并且该记录中的 return_code=success 出现大于或等于 2 条重复记录?

解决方案:

使用以下 sql 查询:

select * from 表 where refund_id in (    select refund_id from 表    where return_code = 'SUCCESS'    group by refund_id    having count(*) >= 2);

此查询通过以下步骤实现:

内部查询 select refund_id from 表… 找到所有 return_codesuccessrefund_id,并按 refund_id 分组。having count(*) >= 2 子句过滤出出现次数大于或等于 2 的 refund_id 组。外部查询 select * from 表… 使用 in 操作符将内部查询的子结果作为 refund_id 的筛选条件,返回符合条件的记录。

因此,执行此查询将返回 refund_id 相同,且 return_code=success 的记录,并且该记录中的 return_code=success 出现至少 2 条重复记录。

以上就是如何查询 MySQL 中 refund_id 相同且 return_code 为 SUCCESS 的记录,并筛选出 return_code=SUCCESS 出现次数大于或等于 2 的记录?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/44467.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年11月7日 07:09:48
Flink 动态表的持续查询
下一篇 2025年11月7日 07:11:50

相关推荐

发表回复

登录后才能评论
关注微信