Oracle SQL syntax issue -




i trying come oracle view , ok first part see below. (only pasting part of syntax here ease). issue , in order sales manger info, have extract cust_knvp table there sql syntax using. problem combine both these syntax below one. can please guide me on this. see tables deliver , orders appear in both syntax. thanks

** /*main view sql syntax*/      select      d.gate_entry_date      k.account_exec_name,     o.load_start_date,     o.local_end_date,     d.local_arrival_date,     p.freight,     d.actual_gate_entry_date,     m.shipm_start,     m.shipment_end     deliver d, ship_pickup_date o,  key_customer k,     reel_date m, orders p,      d.item = m.order_item     , d.sold_to = k.sold_to     , d.shipment_number = o.ship_id     , d.sales_doc = p.sales_doc     ,   d.item = p.item  /* sql syntax sales manager below, need combine both final product.*/     select sales_manager      (     select distinct d.sold_to, p.sales_district, d.sales_office, d.sales_rep     deliver d, orders p     d.sales_doc = p.sales_doc     ,   d.item = p.item) driver, cust_knvp mgr     driver.sold_to = mgr.customer     ,   driver.sales_district = mgr.sales_district     ,   driver.sales_office = mgr.sales_office     ,   driver.sales_rep = mgr.sales_rep 

looking help, thanks.

you can join cust_knvp table directly, referring underlying table columns instead of using driver inline view, accessing same data anyway:

select      d.gate_entry_date,     k.account_exec_name,     o.load_start_date,     o.local_end_date,     d.local_arrival_date,     p.freight,     d.actual_gate_entry_date,     m.shipm_start,     m.shipment_end,     mgr.sales_manager     deliver d, ship_pickup_date o,  key_customer k,     reel_date m, orders p, cust_knvp mgr     d.item = m.order_item     , d.sold_to = k.sold_to     , d.shipment_number = o.ship_id     , d.sales_doc = p.sales_doc     , d.item = p.item     , d.sold_to = mgr.customer     , p.sales_district = mgr.sales_district     , d.sales_office = mgr.sales_office     , d.sales_rep = mgr.sales_rep 

or more modern join syntax:

select      d.gate_entry_date,     k.account_exec_name,     o.load_start_date,     o.local_end_date,     d.local_arrival_date,     p.freight,     d.actual_gate_entry_date,     m.shipm_start,     m.shipment_end,     mgr.sales_manager     deliver d     join ship_pickup_date o on o.ship_id = d.shipment_number     join key_customer k on k.sold_to = d.sold_to     join reel_date m on m.order_item = d.item     join orders p on p.sales_doc = d.sales_doc       , p.item = d.item     join cust_knvp mgr on mgr.customer = d.sold_to       , mgr.sales_district = p.sales_district       , mgr.sales_office = d.sales_office       , mgr.sales_rep = d.sales_rep 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -