How to get below Result Set using below Query..?

  • [font="Times New Roman"]Hi All,

    I have to modify below SQL query to get Required Output as shoe=wn in the attached Excel...

    SelectGT.PLAN_CODE As PLANT,

    GT.FG_DESCRIPTION As T_SIZE,

    GT.PLANNED_QUANTITY As TOTAL_SCH,

    GT.PROGRESS_QTY As PROD_MTD,

    GT.PLANNED_QUANTITY - GT.PROGRESS_QTY As T_BALANCE,

    IT.FG_DESCRIPTION As INCOMING_SIZE,

    IT.PLANNED_QUANTITY As SCH

    FromGT_BAPI_INP_EXP_SCH GT WITH(NOLOCK)

    Inner Join IT_BAPI_INP_EXP_SCH IT WITH(NOLOCK)

    OnGT.PLAN_CODE = IT.PLAN_CODE AND

    GT.MOULD_CODE = IT.MOULD_CODE

    Order By GT.PLAN_CODE ASC

    PFA Excel Sheet of Coming Output from above query and Required Output need...

    NOTE:-

    1) In the Output Result If (GT.FG_DESCRIPTION = IT.FG_DESCRIPTION ) THEN IT.FG_DESCRIPTION = NULL & IT.PLANNED_QUANTITY = NULL

    2) The Marked row(Repeted Rows) in the Required

    Output come to be A Single Row IF there are multiple entries occurs in Output

    Thanks

    Bhushan[/font]

  • Select Distinct

    GT.PLAN_CODE As PLANT,

    GT.FG_DESCRIPTION As T_SIZE,

    GT.PLANNED_QUANTITY As TOTAL_SCH,

    GT.PROGRESS_QTY As PROD_MTD,

    GT.PLANNED_QUANTITY - GT.PROGRESS_QTY As T_BALANCE,

    CASE WHEN GT.FG_DSECRIPTION = IT.FG_DESCRIPTION THEN NULL ELSE IT.FG_DESCRIPTION END AS INCOMING_SIZE,

    CASE WHEN GT.FG_DSECRIPTION = IT.FG_DESCRIPTION THEN NULL ELSE IT.PLANNED_QUANTITY END AS SCH

    From

    GT_BAPI_INP_EXP_SCH GT

    Inner Join

    IT_BAPI_INP_EXP_SCH IT

    On

    GT.PLAN_CODE = IT.PLAN_CODE

    AND

    GT.MOULD_CODE = IT.MOULD_CODE

    Order By

    GT.PLAN_CODE ASC

    Something like the above?

    If not follow the second link in my signature on posting code and data for the best help, to supply us with the CREATE TABLE scripts and sample data from each table so we can play and generate a solution based on your data.

  • [font="Courier New"]Hi Anthony.green

    I managed to display the required output. Thanks for guidance... [/font]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply