• SwePeso (8/28/2007)


    <FONT color=#0000ff size=2>

    SELECT</FONT><FONT size=2> [Part Number]</FONT><FONT color=#808080 size=2>,

    </FONT><FONT color=#ff00ff size=2>SUM</FONT><FONT color=#808080 size=2>(</FONT><FONT color=#0000ff size=2>CASE</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>WHEN</FONT><FONT size=2> Product </FONT><FONT color=#808080 size=2>=</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>'BOM1'</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>THEN</FONT><FONT size=2> ISNULL(Qty, 0) </FONT><FONT color=#0000ff size=2>ELSE</FONT><FONT size=2> 0 </FONT><FONT color=#0000ff size=2>END</FONT><FONT color=#808080 size=2>)</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>AS</FONT><FONT size=2> Bom1Qty</FONT><FONT color=#808080 size=2>,

    </FONT><FONT color=#ff00ff size=2>SUM</FONT><FONT color=#808080 size=2>(</FONT><FONT color=#0000ff size=2>CASE</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>WHEN</FONT><FONT size=2> Product </FONT><FONT color=#808080 size=2>=</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>'BOM1'</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>THEN</FONT><FONT size=2> ISNULL([Extended Cost], 0) </FONT><FONT color=#0000ff size=2>ELSE</FONT><FONT size=2> 0 </FONT><FONT color=#0000ff size=2>END</FONT><FONT color=#808080 size=2>)</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>AS</FONT><FONT size=2> Bom1Cost</FONT><FONT color=#808080 size=2>,

    </FONT><FONT color=#ff00ff size=2>SUM</FONT><FONT color=#808080 size=2>(</FONT><FONT color=#0000ff size=2>CASE</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>WHEN</FONT><FONT size=2> Product </FONT><FONT color=#808080 size=2>=</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>'BOM2'</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>THEN</FONT><FONT size=2> ISNULL(Qty, 0) </FONT><FONT color=#0000ff size=2>ELSE</FONT><FONT size=2> 0 </FONT><FONT color=#0000ff size=2>END</FONT><FONT color=#808080 size=2>)</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>AS</FONT><FONT size=2> Bom2Qty</FONT><FONT color=#808080 size=2>,

    </FONT><FONT color=#ff00ff size=2>SUM</FONT><FONT color=#808080 size=2>(</FONT><FONT color=#0000ff size=2>CASE</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>WHEN</FONT><FONT size=2> Product </FONT><FONT color=#808080 size=2>=</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>'BOM2'</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>THEN</FONT><FONT size=2> ISNULL([Extended Cost], 0)</FONT><FONT color=#0000ff size=2>ELSE</FONT><FONT size=2> 0 </FONT><FONT color=#0000ff size=2>END</FONT><FONT color=#808080 size=2>)</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>AS</FONT><FONT size=2> Bom2Cost

    </FONT><FONT color=#0000ff size=2>FROM</FONT><FONT size=2> Table1

    </FONT><FONT color=#0000ff size=2>GROUP</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>BY</FONT><FONT size=2> [Part Number]

    </FONT><FONT color=#808080 size=2>ORDER</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>BY</FONT><FONT size=2> [Part Number]</FONT>

    <FONT size=2></FONT>

    😀