SHARE
TWEET

Untitled

a guest Feb 20th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select DISTINCT mi.*,csq.contract_code
  2.   from master_items mi
  3.   join contract_shipment_qty csq on csq.item_code = mi.code
  4.   join contract c on c.code = csq.contract_code
  5.   join master_item_products mp on mp.master_item = mi.id
  6.   join hscode h on h.code = product_hscodes.hscode
  7.  where csq.shipment_id = 6
  8.    and csq.contract_code = '046V-12-A04-05'
  9.    and mi.code = 'M165'
  10.    and h.code = '12345'
  11.    
  12. from master_items mi
  13. join contract_shipment_qty csq on csq.item_code = mi.code
  14. join contract c on c.code = csq.contract_code
  15. join master_item_products mp on mp.master_item = mi.id
  16.  
  17. join product_hscodes
  18.      on product_hscodes.fk = <primary table>.pk //<<Have you joined this table?
  19.  
  20. join hscode h on h.code = product_hscodes.hscode
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top