Select Statement Help

  • I have the following script :

    SELECT Invoiced,DeliveryNoteNo,DocumentNo,ORIGTYPE,OrderNo,Shipdate,CustNo,CUSTNAME,ItemNo,ITEMDESC

    FROM dbo.RPTDeliveryNotes

    I get the output on the Invoiced fields as 2 and 3. How do I convert the 2 for Invoiced and the 3 for Not Invoiced?

  • Hi,

    That's quite straightforward through the use of a case statement.

    SELECT

    CASE

    WHEN Invoiced = 2 THEN 'Invoiced'

    WHEN Invoiced = 3 THEN 'Not Invoiced'

    ELSE 'Unknown'

    END,

    DeliveryNoteNo,

    DocumentNo,

    ORIGTYPE,

    OrderNo,

    Shipdate,

    CustNo,

    CUSTNAME,

    ItemNo,

    ITEMDESC

    FROM dbo.RPTDeliveryNotes



    MCSE: Data Platform
    MCSE: Business Intelligence
    Follow me on Twitter: @WazzTheBadger
    LinkedIn Profile: Simon Osborne

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

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