question

AlexKlap avatar image
AlexKlap asked

Element Present in master must present with slave

Respected All, Kindly help me on this if possible. a real complicated one. two table:- **Table 1**:- FRYear|FRInstr|FRMod|FRCOM|FRCOM2|TOYR|ToInstr|TOMod|TOCOM|TOCOM2 2006|Amplifier|silveredo|NULL|NULL|2007 |Amplifier|silveredo|CLASSIC|NULL 2013|Booster |Power |NULL|NULL|2014 |Booster | Signal |NULL |NULL **Table 2** Instr | Mod | year | SKU | COM | COM Amplifier | silveredo | 2006 | BRKPOCALP | NULL |NULL Amplifier | silveredo | 2006 | CRDPTCALP | NULL |NULL Amplifier | silveredo | 2007 | BRKPOCALP | CLASSIC |NULL Amplifier | silveredo | 2007 | CRDPTCALP | CLASSIC |NULL Booster | Power | 2013 |AAA630542 |NULL |NULL Booster | Power | 2013 |BBA630542 |NULL |NULL Booster | Power | 2013 |XXXYYYYY |NULL |NULL Booster | Power | 2013 |NVW20002 |NULL |NULL Booster | Power | 2013 |W2AA0002 |NULL |NULL Booster | Signal | 2014 |AAA630542 |NULL |NULL Booster | Signal | 2014 |BBA630542 |NULL |NULL Booster | Signal | 2014 |NVW20002 |NULL |NULL Booster | Signal | 2014 |W2AA0002 |NULL |NULL Output 2006|Booster |Power |NULL|NULL|2013 |Booster | SAKTI |NULL | AC|XXXYYYYY 1. ALL Ooperation will be done on table 2 called as @table2 2. SKU Present with value given in driver table (frommake,frommodel,fromyear) should also present with value of all not null columns i.e (Tomake,Tomodel,tomodel) and if remarks1 is not null than (Tomake,Tomodel,tomodel,ToRemarks) 3. Output will be from @table2 so Output will be make model year SKU REMARKS1 REMARKS2 Booster Power 2013 XXXYYYYY NULL NULL- as XXXYYYYY is not present with '2014' ,'Booster' , 'Signal' Thank You Very Much for your kind help.
sql-server-2008t-sqldynamic-sql
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kev Riley avatar image
Kev Riley answered
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.