gpt4 book ai didi

查找重复项的 SQL 查询不返回任何结果

转载 作者:行者123 更新时间:2023-12-04 06:54:20 25 4
gpt4 key购买 nike

我知道此表中有重复的帐号,但此查询未返回任何结果。

SELECT [CARD NUMBER],[CUSTOMER NAME],[ACCT NBR 1],[ACCT NBR 2],

COUNT([ACCT NBR 1]) AS NumOccurences

FROM DebitCardData.dbo.['ATM Checking Accts - Active$']

GROUP BY [CARD NUMBER],[CUSTOMER NAME],[ACCT NBR 1],[ACCT NBR 2]

HAVING (COUNT([ACCT NBR 1])>1)

最佳答案

我认为您的查询没有错误,但这可能对您有用

SELECT [CARD NUMBER],[CUSTOMER NAME],[ACCT NBR 1],[ACCT NBR 2],

NumOccurences

FROM DebitCardData.dbo.['ATM Checking Accts - Active$'] as accMailTbl

inner join

(SELECT [ACCT NBR 1],COUNT([ACCT NBR 1]) AS NumOccurences

FROM DebitCardData.dbo.['ATM Checking Accts - Active$']

GROUP BY [ACCT NBR 1] HAVING (COUNT([ACCT NBR 1])>1)) accTbl

on accTbl.[ACCT NBR 1]=accMailTbl.[ACCT NBR 1]

关于查找重复项的 SQL 查询不返回任何结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2731135/

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