Advertisement

09.30.2008 at 05:41PM PDT, ID: 23776641
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

How to combine records between 2 tables that have a 1 to many relationship ?

Asked by zimmer9 in Microsoft ADP, MS SQL Server, SQL Query Syntax

I am developing an Access application using Access as the front end and SQL Server as the back end database.

I have 2 tables that I join and I want to combine the dollar field [Original Commitment] from table
ztbl_Master_Template with the record(s) from another table ztbl_Source_SSFIII.
************************************************************************
For example, the following represent some of the fields from the 2 input tables
1) ztbl_Source_SSFIII  2) ztbl_Master_Template
and there is 1 ouput table titled ztbl_Source_Funds_Ungrouped_SSFIII

************************************************************************
ztbl_Source_SSFIII

Investor     Legal                                                                                         Income          Capital
Name         Entity      GP                     Contributions    Redemptions   Distributions  Distibutions   masterid
-----------   -------      ----------------    ---------------     ---------------        --------------         ----------              -----------
A. Levin     Class A  Non MS LP/GP   54859.00         25                        30                   10                     2868
A. Levin     Class A  Non MS LP/GP       200.00         40                        50                   20                     2868
A. Levin     Class A  Non MS LP/GP       300.00         60                        20                   40                     2868
A. Levin     Class A  Non MS LP/GP       100.00         80                        10                   44                     2868
************************************************************************
ztbl_Master_Template

Account    Legal                               Original
Name         Entity                               Commitment
---------      -------------------------      ---------------  
A. Levin     MS L.P. Class A Unit       25000.00                
************************************************************************
ztbl_Source_Funds_Ungrouped_SSFIII

masterid    originalCommitment      Redemptions    Distributions        masterid   Contributions
-----------   -----------------------             ---------------          -----------------         ----------     ---------------
2868          25000.00                         205                        224                         2868                 55459

My existing SQL Statement is shown in the Attach Code Snippet section and is not correct because it is overstating the originalCommitment value as a value of 25000 taken from
ztbl_Master_Template times 4 = 100000 in the resulting table.

The system takes the original commitment value of 25000 from the table ztbl_Master_Template and assigns it to the 4 records in table ztbl_Source_SSFIII and then sums these 4 records and calculates the total Original Commitment as 100000 in the resulting table.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
INSERT INTO ztbl_Source_Funds_Ungrouped_SSFIII (masterID, Fund, reportClientName, originalCommitment,
Redemptions, Reinvestments, Nav, Market_app_depre, Distributions, sourceid, reportDt, sourceFund, [Gross_Sales],
[Investor Name], GP, B.[Legal Entity], ExtractType)
SELECT A.id AS masterID, A.[Fund Name] AS Fund,'Morgan Stanley' As reportClientName, 
SUM(ISNULL(A.[original commitment],0)) As [Original Commitment], 
SUM(ISNULL(B.Redemptions,0)) AS Redemptions, 
0.0, 0.0, 0.0, 
SUM(ISNULL(B.[Income Distributions],0)) + SUM(ISNULL(b.[Capital Distributions],0)) As Distributions, 
[Account Name], 
Max(filedate) As [Reporting Date], 
'SSFIII', 
SUM(ISNULL(B.Contributions,0)) AS Contributions, 
B.[Investor Name], B.GP, B.[Legal Entity], 'GPLP' 
FROM ztbl_Master_Template A 
INNER JOIN ztbl_Source_SSFIII B ON 
B.[Investor Name] = A.[Account Name] AND 
A.[Legal Entity]    LIKE '%' + B.[Legal Entity] + '%' 
AND B.GP NOT IN('MS GP','MS LP') AND (B.[Legal Entity] NOT LIKE '%CLASS E%' AND B.[Legal Entity] NOT LIKE '%CLASS O%') AND id = '2868'
GROUP BY B.[Investor Name],B.[Legal Entity], A.id, A.[Fund Name], A.[Account Name],GP
 
Loading Advertisement...
 
[+][-]09.30.2008 at 06:03PM PDT, ID: 22610811

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:28PM PDT, ID: 22610939

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:36PM PDT, ID: 22610965

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:38PM PDT, ID: 22610978

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:42PM PDT, ID: 22610993

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:43PM PDT, ID: 22610995

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:43PM PDT, ID: 22610997

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.30.2008 at 06:44PM PDT, ID: 22611005

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft ADP, MS SQL Server, SQL Query Syntax
Sign Up Now!
Solution Provided By: vadimrapp1
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09.30.2008 at 06:59PM PDT, ID: 22611061

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628