Consulting

Results 1 to 2 of 2

Thread: Sleeper: Decode function

  1. #1

    Sleeper: Decode function

    Hi,

    I am trying to write a decode function and I want to say "if the column 1 contains 100 in row 5 and the column 2 contains the word CAT then return the amount in column 6.

    If I remember rightly the decode function would have a || in it somewhere but I can't remember. Can someone help. I am querying an Oracle database using SQL.

    Thanks

    Ian

  2. #2
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    I am not familiar with Oracle Syntax...(SQL Server doesn't have that function that I am familar with)

    In SQL you could do a Case..When operation

    Select Column6 
    FRom [Table]
    Where COlumn 1 = 100 and column2 = 'CAT'
    Or

    Select (Case When Column1 = 100 and column2 = 'CAT' then Column6 else NULL end)
    FROm [Table]
    If you have posted the same question at multiple forums, please read this IMPORTANT INFO.

    Please use the thread tools to mark your thread Solved


    Please review the Knowledge Base
    for samples and solutions , or to submit your own!




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •