Home » SQL & PL/SQL » SQL & PL/SQL » Need help on query (Oracle11g)
Need help on query [message #665337] Thu, 31 August 2017 03:54 Go to next message
ssyr
Messages: 65
Registered: January 2017
Member
Hi all,

Please could you help me in below query I need to dispay column from other table.




(select
       tw.account_id  as ACCT_ID,
       tw.oidd  
       ,new_value
from tw
left join  booked_tbl bod
on tw.oidd     = bod.oidd
and tw.pid = bod.pid
left join  sm_dmd_tbl smdo
on tw.oidd     = smdo.oidd
and tw.pid = smdo.pid
where 1=1
group by tw.account_id , tw.oidd );


I need to display one more column brkup in above query.in the below format
" gp_code|amt " based on id.this clumn values is fom different table.
my other query is :

select substr(replace(sys_connect_by_path(name,'/'),'/',','),2) brkup
from ( select aw_transaction_id,  GROUPCODE||'|'||amt name, 
    row_number() over(partition by transid order by GROUPCODE) rn
from  at_PARTS
)
where connect_by_isleaf = 1
connect by prior transid = transid 
and prior rn = rn-1
start with rn = 1 ;

I want as a output:
ACCT_ID tw.oidd new_value brkup (this value is based on concatenation of gpcode)

How can I show this dispaly this type of output?


Thanks in advanced.
Re: Need help on query [message #665339 is a reply to message #665337] Thu, 31 August 2017 05:36 Go to previous message
John Watson
Messages: 8929
Registered: January 2010
Location: Global Village
Senior Member
Your first query is syntactically incorrect. If you want to group by tw.account_id , tw.oidd, you must apply an aggregation to new_value. Also, in which table does the column new_value exist?
Previous Topic: Conversion into Clob from Varchar2
Next Topic: How to show multiple data in single row
Goto Forum:
  


Current Time: Fri Apr 19 16:41:34 CDT 2024