Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 find duplicate fields in db
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 01/22/2013 :  05:38:54  Show Profile  Reply with Quote
Hi i need to write to find where parameter 1 is a bank account no, i need to see where debits are ran against this account no for different companies. The end result should populate a grid in delphi, showing the same account no over and over for each company that has debited the account. I have 2 tables clients which includes the client info and a paymentsdue table which payment details. They are join on a company serialno field. The query i have is below, the serialno included are all the companies is question. This however does not just show me the duplicate entries but all of them. Any help is much appreciated.

SELECT c.Accountno,c.serialno,c.ClientID,e.DueDate
FROM ebtpaymentsdue e inner join clients c
on e.SerialNo = c.SerialNo and e.ClientNo = c.ClientNo and c.AccountNo = c.AccountNo
where e.DueDate >= GETDATE() and e.DueDate <= getdate() + 10
and 1 < (select count(*) from clients c1 where c1.AccountNo = c.AccountNo) and c.serialno in (
GROUP BY c.Accountno,c.serialno,c.ClientID,e.DueDate
ORDER BY c.Accountno DESC

  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000