• lax.rawat07 (11/10/2010)


    i have a result set

    LedgerId, ProfitAndLoss

    46 -3000.00

    49 -7000.00

    45 15000.00

    I want Result Set As

    LedgerId, ProfitAndLoss Result

    46 -3000.00 Credit

    49 -7000.00 Credit

    45 15000.00 Debit

    Please help me ProfitAndLoss Is a Decimal field and we have to separated by minus value

    You can set this extra field with a case statement in your SELECT query as such:

    SELECT LEDGERID, PROFITANDLOSS, RESULT =

    CASE WHEN PROFITANDLOSS <= 0

    THEN CREDIT

    ELSE DEBIT

    END

    FROM MYTABLE

    OR, you can add a calculated field to your underlying table.


    Regards,

    goodguy

    Experience is a bad teacher whose exams precede its lessons