Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> How to compare values in the same column

How to compare values in the same column

From: <sxbktm_at_my-deja.com>
Date: Tue, 21 Sep 1999 20:51:37 GMT
Message-ID: <7s8r4k$utq$1@nnrp1.deja.com>


Hi all,

I have two columns called minutes and cookie in a table call T1. For each cookie, I want to add minutes of the rows corresponding to the cookie so that if minutes is greater than 30, I display a session that is displayed from another table, T2.

select session from T1,T2 where T1.cookie=T2.cookie and (max (T1.minutes)-min(T1.minutes)) = T2.minutes.

The problem here is the difference of 30 minutes may not necessarily have to do with only max of minutes and min of minutes. 30 minutes of difference for one cookie could happen anywhere within the rows corresponding to the cookie. Can Oracle's DECODE be useful here.

I am trying my best not to use PL/SQL or Perl. Is there a SQL answer.

Thanks in advance.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Sep 21 1999 - 15:51:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US