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: Oracle qry

RE: Oracle qry

From: Kamaljeet Singh <kamalj_at_mahindrabt.com>
Date: Tue, 11 Mar 2003 03:48:48 -0800
Message-ID: <F001.00565BBE.20030311034848@fatcity.com>

Select * from (
select
distinct(decode(b.sys_id,'TRDENG',a.cust_bas_no,a.cosmos_base_no)) baseno ,a.br_cod,pty_nam,bank_name,
rank() over (partition by baseno ,a.br_cod order by pty_nam) as rk from piar_fr_psd a, psd b, bank_br c
where a.psd_id=b.psd_id
and a.psd_serial_num = b.psd_serial_no
and b.bank_id = c.bank_id
and (((sys_id = 'TRDENG') and (a.cust_bas_no is not null)) or ((sys_id <> 'TRDENG') and (a.cosmos_base_no is not null))) )
where rk = 1;

Kamal.

-----Original Message-----
manoj.gurnani_at_orbitech.co.in
Sent: 11 March 2003 10:56
To: Multiple recipients of list ORACLE-L

Hi All,

         I've the following qry :

select
distinct(decode(b.sys_id,'TRDENG',a.cust_bas_no,a.cosmos_base_no)) baseno ,a.br_cod,pty_nam,bank_name
from piar_fr_psd a, psd b, bank_br c
where a.psd_id=b.psd_id
and a.psd_serial_num = b.psd_serial_no
and b.bank_id = c.bank_id
and (((sys_id = 'TRDENG') and (a.cust_bas_no is not null)) or ((sys_id <> 'TRDENG') and (a.cosmos_base_no is not null)))

o/p :
baseno br_cod pty_nam bank_name

 1        10     x1     y1
 1        10     x111   y1
 1        10     x1334  y1
 2        20     x212   y2
 2        20     x213   y2

For a baseno,br_cod combination I need only one row to be displayed. i.e any one pty_nam should be displayed .

o/p :

baseno br_cod pty_nam bank_name

 1        10     x1     y1
 2        20     x213   y2

How can I achieve this.

Thanks
Manoj

--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author:
  INET: manoj.gurnani_at_orbitech.co.in

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). ********************************************************* Disclaimer This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Kamaljeet Singh INET: kamalj_at_mahindrabt.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 Tue Mar 11 2003 - 05:48:48 CST

Original text of this message

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