Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select DISTINCT mi.*,csq.contract_code
- from master_items mi
- join contract_shipment_qty csq on csq.item_code = mi.code
- join contract c on c.code = csq.contract_code
- join master_item_products mp on mp.master_item = mi.id
- join hscode h on h.code = product_hscodes.hscode
- where csq.shipment_id = 6
- and csq.contract_code = '046V-12-A04-05'
- and mi.code = 'M165'
- and h.code = '12345'
- from master_items mi
- join contract_shipment_qty csq on csq.item_code = mi.code
- join contract c on c.code = csq.contract_code
- join master_item_products mp on mp.master_item = mi.id
- join product_hscodes
- on product_hscodes.fk = <primary table>.pk //<<Have you joined this table?
- join hscode h on h.code = product_hscodes.hscode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement