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

RE: query

From: Mercadante, Thomas F <thomas.mercadante_at_labor.state.ny.us>
Date: Tue, 29 Mar 2005 08:10:34 -0500
Message-ID: <C9995D8C5E0DDA4A8FF9D68EE666CE0704AC03BD@exchsen0a1ma>


Seema,

Add an order by clause using decode:

select known_category_id, count(rowid) from ovt_recognized_categories where known_category_id in (3,1,8,7)
group by known_category_id
order by decode(known_category_id,3,10,1,20,8,30,7,40) <=========

Tom

-----Original Message-----

From: Seema Singh [mailto:oracledbam_at_hotmail.com] Sent: Tuesday, March 29, 2005 8:04 AM
To: oracle-l_at_freelists.org
Subject: query

hi
I'm getting the output from following
select known_category_id, count(rowid) from ovt_recognized_categories where known_category_id in (3,1,8,7)
group by known_category_id ;

KNOWN_CATEGORY_ID COUNT(ROWID)
----------------- ------------

               1            1
               3            1
               7            1
               8            1

I want the out would be like
KNOWN_CATEGORY_ID COUNT(ROWID)
----------------- ------------
               3            1
               1            1
               8            1
               7            1

Following are sample data.

ROWNUM ROWID KNOWN_CATEGORY_ID
---------- ------------------ -----------------

        1 AAANmrAAcAAAY0wAAA               986
        2 AAANmrAAcAAAY0wAAB                 1
        3 AAANmrAAcAAAY0wAAC                 2
        4 AAANmrAAcAAAY0wAAD                 3
        5 AAANmrAAcAAAY0wAAE                 4
        6 AAANmrAAcAAAY0wAAF                 5
        7 AAANmrAAcAAAY0wAAG                 6
        8 AAANmrAAcAAAY0wAAH                 7
        9 AAANmrAAcAAAY0wAAI                 8
       10 AAANmrAAcAAAY0wAAJ                 9
Please sugget what would be query.
thanks
-Seema

--

http://www.freelists.org/webpage/oracle-l
--

http://www.freelists.org/webpage/oracle-l Received on Tue Mar 29 2005 - 08:14:20 CST

Original text of this message

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