Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement