gpt4 book ai didi

mysql - 从 mysql 中选择重复值并显示所有这些值

转载 作者:行者123 更新时间:2023-11-29 23:20:15 25 4
gpt4 key购买 nike

我目前有以下 SQL 查询来提取所有重复值:

Select `Racetime`,`Trainer`
from tom_cards
where `Trainer` in (
select `Trainer`
FROM tom_cards
GROUP BY `Racetime`,`Trainer`
HAVING COUNT(*) > 1
)

我想要更多类似的东西

Select `Racetime`,`Trainer`
from tom_cards
where `Trainer` and `Racetime in (
select `Trainer` and `Racetime`
FROM tom_cards
GROUP BY `Racetime`,`Trainer`
HAVING COUNT(*) > 1
)

但这无效。表达相同内容的有效查询是什么?

最佳答案

你可以连接

Select Racetime,Trainer from tom_cards 
where concat(Racetime,Trainer) in
(select concat(Racetime,Trainer) FROM tom_cards
GROUP BY Racetime,Trainer
HAVING COUNT(*) > 1)

关于mysql - 从 mysql 中选择重复值并显示所有这些值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27385023/

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