Posted - 01/22/2013 : 05:38:54
| 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.
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