Forum Discussion
ygoshy
Apr 30, 2022Copper Contributor
Query in access by linking
I have data the looks like the below. I want to create a query that will give me a result like the second one. I want all "PCFN" numbers that are the same but the "Carrier" is different as shown in s...
arnel_gp
Apr 30, 2022Iron Contributor
you may try:
SELECT [yourTableName].*
FROM [yourTableName] INNER JOIN (SELECT PCFN, COUNT("1") AS CNT FROM (SELECT [yourTableName].Carrier, [yourTableName].PCFN
FROM [yourTableName] GROUP BY [yourTableName].Carrier, [yourTableName].PCFN) GROUP BY PCFN) AS T
ON [yourTableName].PCFN = T.PCFN WHERE T.CNT > 1
ORDER BY Carrier, [Paid Date]
SELECT [yourTableName].*
FROM [yourTableName] INNER JOIN (SELECT PCFN, COUNT("1") AS CNT FROM (SELECT [yourTableName].Carrier, [yourTableName].PCFN
FROM [yourTableName] GROUP BY [yourTableName].Carrier, [yourTableName].PCFN) GROUP BY PCFN) AS T
ON [yourTableName].PCFN = T.PCFN WHERE T.CNT > 1
ORDER BY Carrier, [Paid Date]
ygoshy
May 01, 2022Copper Contributor
arnel_gp I am not a expert query writer and a little confused by your response. My table has many columns and almost a million rows in it. See below this is how I tried to do this query. The goal is the have a result where the PCFN is the same but the Carrier is different name. Will this additional information help your investigation to solve my issue?