DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Decode function

  1. #1
    Join Date
    Sep 2002
    Posts
    376

    Decode function

    Hi,
    Can i use two column names in a single decode function...

    for eg
    select sum(decode(A.TableA,20,B.TableB,0)) .....

    I was analyzing a query just similar to above select stmt. Was just wondering why they have used two columns in one decode function...

    can somebody put some light on this...
    Last edited by bang_dba; 07-25-2003 at 03:07 AM.

  2. #2
    Join Date
    Jul 2001
    Location
    Slovenia
    Posts
    422
    It does sum(value) where value is defined as:
    if A.TableA = 20 then value=B.TableB
    else value=0
    Tomaž
    "A common mistake that people make when trying to design something completely
    foolproof is to underestimate the ingenuity of complete fools" - Douglas Adams

Posting Permissions

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


Click Here to Expand Forum to Full Width