Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    29

    Unanswered: difference function in oracle

    Hi aLL,
    I have a database running oracle 10g. I want to know if there is an oracle function that takes care of difference between two values in two different rows of thesame column.
    Thanks
    'Soga

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Function? What about '-' operator?
    Code:
    SQL> select empno, ename, sal from emp;
    
         EMPNO ENAME             SAL
    ---------- ---------- ----------
          7369 SMITH             800
          7499 ALLEN            1600
          7521 WARD             1250
    ...
    14 rows selected.
    
    SQL> select x.sal - y.sal
      2  from (select sal from emp where ename = 'ALLEN') x,
      3       (select sal from emp where ename = 'SMITH') y;
    
    X.SAL-Y.SAL
    -----------
            800
    
    SQL>

Posting Permissions

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