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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query help.

Author  Topic 

JustinJ2011
Starting Member

1 Post

Posted - 2011-09-09 : 11:20:34
Im currently working on a project where it requires that I reconstruct a payment history for a group of debtors within a portfolio. Due to the large amount of payment line items compounded by the uncertainty of whether these payments were made directly by the debtor or the insurance company, I took to SQL to try and help piece together the puzzle.

The scenario is as follows:

I have two spreadsheets...one containing a complete payment history (comprised of both debtor and insurance company payments) and the other containing the remaining installments left in the portfolio (unpaid). The object is to obtain only the payment line items made directly by the debtor and not the insurance company. The logic is that any item that appears in the payment history sheet that also appears in the installment portfolio sheet is an insurance company payment, and should be disregarded. The remaining items would in fact be the actual payments made by the debtor.

I have tried multiple queries utilizing the CONCAT and DISTINCT commands to single out these items but seem to be running into a few difficulties in obtaining the precise results that Im looking for. I attempted to Concatenate three fields (Maturity, Guarantor and Amount) that appear in both sheets to create a unique identifier in which I could then run DISTINCT on to pull the unique line items based on this concatenated "field."

Im not quite sure if my logic and approach are on track, but I was wondering if anyone could make any suggestions on how to go about solving this problem.

All help is greatly appreciated.

Thanks!

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-09-09 : 12:05:43
Most of the experts on this forum are more adept at reading DDL statements and interpreting them; so if you can post the DDL statements and some sample data and expected output data, I am sure some of them would be able to offer suggestions. Brett's blog might help you in getting the DDL.

Also, this forum is for Microsoft SQL Server. If you are using another DBMS such as Oracle, you may get better and faster responses at a forum that specializes in that DBMS. dbforums.com
Go to Top of Page
   

- Advertisement -