I am developing an Access application using Access as the front end and SQL Server as the back end database.
I am working with 2 SOURCE tables with the following FIELDS and values:
I would like to create 1 TARGET table named ztbl_Source_Funds_Ungroupe
d.
1) ztbl_Source_SSFIII
[Investor Name] [Legal Entity] Contributions reportDt
ABC CO. Class A 5.00 2008-06-30 00:00:00.000
ABC CO. Class A 8.00 2008-06-30 00:00:00.000
XYZ. CO. Class E 3.00 2008-06-30 00:00:00.000
XYZ CO. Class E 9.00 2008-06-30 00:00:00.000
2) ztbl_Master_Template
[Account Name] [Legal Entity] [Fund Name] id Commitment
ABC CO. MS Class A Units SSFIII 2908 500.00
XYZ CO. MS Class E Units SSFIII 2910 700.00
XYZ CO MS Class E Units SSFIII 2911 0.00
How would you create a SQL Insert Statement to achieve the following output using the
SQL Insert ?
INSERT INTO ztbl_Source_Funds_Ungroupe
d (id, [Fund Name], Contributions, reportDt)
SELECT ztbl_Master_Template.id ...
I would like to match the 2 source tables on:
ztbl_Source_SSFIII.[Invest
or Name] = ztbl_Master_Template.[Acco
unt Name] AND
ztbl_Source_SSFIII.[Legal Entity] LIKE '%' + ztbl_Master_Template.[Lega
l Entity] + '%'
To get the [Legal Entity] value is a matter of finding ztbl_Source_SSFIII.[Legal Entity] anywhere in the
field value ztbl_Master_Template.[Lega
l Entity] (% [Legal Entity] %)
Target (output) table
ztbl_Source_Funds_Ungroupe
d
id Fund Name Contributions reportDt [Legal Entity] Commitment
------- -------------- ---------------- --------------------------
---- ------------------ ---------------
2908 SSFIII 13.00 2008-06-30 00:00:00.000 Class A 500.00
2910 SSFIII 12.00 2008-06-30 00:00:00.000 Class E 700.00
Start Free Trial