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: Return the first row only

RE: Return the first row only

From: Sony kristanto <Sony_at_polyfincanggih.com>
Date: Wed, 29 Jan 2003 17:54:08 -0800
Message-ID: <F001.0053E0A6.20030129175408@fatcity.com>


> Hi Ranganath,
>
> select 'shipment' table_name,ce.display_name,st.timestamp, sequence
> from shipment_timestamp st, customer_event ce, xm_field xm
> where shipment_id = 10402344721477
> and ce.CUSTOMER_MOT_ID = 1040130035205
> and xm.field_id = ce.field_id
> and st.event_id = xm.event_id
> and rownum = 1
> union
> select 'container' table_name,ce.display_name,sct.timestamp, sequence
> from shipment_container_timestamp sct, customer_event ce, xm_field xm
> where shipment_id = 10402344721477
> and ce.CUSTOMER_MOT_ID = 1040130035205
> and xm.field_id = ce.field_id
> and sct.event_id = xm.event_id
> and rownum = 1
> union
> select 'order' table_name,ce.display_name,ot.timestamp, sequence
> from order_timestamp ot, shipment_order so,customer_event ce, xm_field xm
> where so.shipment_id = 10402344721477
> and so.order_id = 2
> and ot.shipment_order_id = so.shipment_order_id
> and ce.CUSTOMER_MOT_ID = 1040130035205
> and xm.field_id = ce.field_id
> and ot.event_id = xm.event_id
> and rownum = 1
> order by sequence desc
>
> Using rownum is fine.
>
> Rgrds,
>
> Sony
>
>
> Hi List,
>
> I have the below query which returns 13 records. In this I want to
> display
> only the 1st row. Is it possible to do this through rownum or any other
> function or pseudo column? If so, please let me know the same. Any help
> in
> this regard is very much appreciated.
>
> select 'shipment' table_name,ce.display_name,st.timestamp, sequence
> from shipment_timestamp st, customer_event ce, xm_field xm
> where shipment_id = 10402344721477
> and ce.CUSTOMER_MOT_ID = 1040130035205
> and xm.field_id = ce.field_id
> and st.event_id = xm.event_id
> union
> select 'container' table_name,ce.display_name,sct.timestamp, sequence
> from shipment_container_timestamp sct, customer_event ce, xm_field xm
> where shipment_id = 10402344721477
> and ce.CUSTOMER_MOT_ID = 1040130035205
> and xm.field_id = ce.field_id
> and sct.event_id = xm.event_id
> union
> select 'order' table_name,ce.display_name,ot.timestamp, sequence
> from order_timestamp ot, shipment_order so,customer_event ce, xm_field xm
> where so.shipment_id = 10402344721477
> and so.order_id = 2
> and ot.shipment_order_id = so.shipment_order_id
> and ce.CUSTOMER_MOT_ID = 1040130035205
> and xm.field_id = ce.field_id
> and ot.event_id = xm.event_id order by sequence desc
>
> Thanks and Regards,
>
> Ranganath
> WARNING: The information in this message is confidential and may be
> legally
> privileged. It is intended solely for the addressee. Access to this
> message
> by anyone else is unauthorised. If you are not the intended recipient,
> any
> disclosure, copying, or distribution of the message, or any action or
> omission taken by you in reliance on it, is prohibited and may be
> unlawful.
> Please immediately contact the sender if you have received this message in
> error. Thank you.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Krishnaswamy, Ranganath
> INET: Ranganath.Krishnaswamy_at_blr.hpsglobal.com
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> 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.net
-- 
Author: Sony kristanto
  INET: Sony_at_polyfincanggih.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Jan 29 2003 - 19:54:08 CST

Original text of this message

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