Please can any one suggest on my query below. I need only records having more than 1 same customerid.
Select b.customerid, b.accountno
from customer a, account b, address c
where
a.customerid=b.customerid and
b.accountno=c.accountno and
b.status='active'
group by b.customerid, b,accountno
having count(customerid) > 1;
For some reasons, I am getting single records along with duplicate records. I am only looking for duplicate records.
Eg; When I execute my query, I am geting the below records.
customerid accountno
A111 12345
A111 23456
B123 65432
C222 10101
C222 11122
But I am looking for only the below records:
A111 12345
A111 23456
C222 10101
C222 11122
Please help.
Select duplicate records
Re: Select duplicate records
Hi Kitz,
would you mind passing us your (relevant) table definitions for customer, account and address, and provide some data for these three tables?
BTW, your 'having' clause refers to a unqualified column 'customerid', but it looks like customerid is a member of both customer and account tables.
Thank you
alexm
would you mind passing us your (relevant) table definitions for customer, account and address, and provide some data for these three tables?
BTW, your 'having' clause refers to a unqualified column 'customerid', but it looks like customerid is a member of both customer and account tables.
Thank you
alexm
-
- Similar Topics
- Replies
- Views
- Last post
-
- 4
- 2241
-
by sergeyken
View the latest post
Mon Jun 26, 2023 12:56 am
-
-
Finding duplicate in variable lenght string in cobol
by kanipriya2785 » Fri Jun 17, 2022 10:02 pm » in IBM Cobol - 8
- 3452
-
by sergeyken
View the latest post
Wed Jun 22, 2022 3:10 am
-
-
-
Insert records from File1 between records of File2
by Daouchiche » Wed Nov 10, 2021 6:37 am » in DFSORT/ICETOOL/ICEGENER - 6
- 2342
-
by sergeyken
View the latest post
Thu Nov 11, 2021 12:43 am
-
-
- 3
- 3717
-
by naveenkumar sudha
View the latest post
Mon May 09, 2022 10:15 pm
-
- 6
- 2368
-
by sergeyken
View the latest post
Thu Dec 09, 2021 8:10 pm