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: Nicoll, Iain (Calanais) <iain.nicoll_at_calanais.com>
Date: Wed, 12 Sep 2001 08:58:47 -0700
Message-ID: <F001.0038BBBC.20010912090523@fatcity.com>

Seema,

The following would work (there will be better ways to do it especially if you're on Oracle 8) but I'm stuck with 7.3. You'll need to have access to a table which will always have at least have 15 rows (I've used all_objects here).

SELECT day, COUNT(*)
FROM table_name,

     (SELECT ROWNUM day
          FROM ALL_OBJECTS
          WHERE ROWNUM < 16)

WHERE day BETWEEN sday AND eday
GROUP BY day

-----Original Message-----
Sent: 12 September 2001 14:20
To: Multiple recipients of list ORACLE-L

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: Seema Singh
  INET: oracledbam_at_hotmail.com

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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Nicoll, Iain (Calanais)
  INET: iain.nicoll_at_calanais.com
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:58:47 CDT

Original text of this message

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