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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: QUERY HELP?

Re: QUERY HELP?

From: Jan Pruner <jan_at_pruner.cz>
Date: Wed, 12 Sep 2001 08:08:38 -0700
Message-ID: <F001.0038B925.20010912075520@fatcity.com>

If I understand it right you need a count for every day in interval records. I think, that the easiest way how to get right numbers (it's not much sophisticated, but ...) is:

  1. create table day_count( day_id number, day_nbr number );
  2. fill table day_count with tuples where day_id starts at 1 and goes up to max( eday of your source table), day_nbr is 0.
  3. for every tuple in your source table do: update day_count set day_nbr := day_nbr +1 where day_id >= sday and day_id <=eday;
  4. simply select

Best regards

JP

On Wed 12. September 2001 15:20, you wrote:
> Hi
> I need help to get query
> sno is primary key of table
>
> sday and eday will be between (1 and 15)
>
> rowno, sday eday
> 1 2 5
> 2 4 4
> 3 4 5
> 4 8 9
> 5 9 10
>
> the "day" output will be the no which can be equal to sday
> or equal to eday or between sday and eday
>
> we should get output as
> day count
> 2 1 ( in row 1, 2 is equal to sday )
> 3 1 ( it is in row 1, b/n 2 and 5 )
> 4 3 ( in row 2,3 equal to sday and eday ,and b/n 2and5 in row 1 )
> 5 2 like that...
> 8 1
> 9 2
> 10 1
>
>
> Thanks
> Seema
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jan Pruner
  INET: jan_at_pruner.cz

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Sep 12 2001 - 10:08:38 CDT

Original text of this message

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