Jump to content

SELECT DISTINCT FROM LEFT JOIN


newphpcoder

Recommended Posts

Hi..

 

I have query but i got problem in data which I need to DISTINCT.

 

here is my query:

 

SELECT p.PCODE, p.min_lot, p.max_lot, kd.LOT_CODE, kd.wip_chemicalweighing, kd.wip_compounding, kd.wip_extrusion, kd.wip_forming, 
kd.wip_deflashing, kc.count_wip_chemical_weighing, kc.count_wip_compounding, kc.count_wip_extrusion, kc.count_wip_forming, 
kc.count_wip_deflashing, kc.kanban, kc.virtual FROM (SELECT DISTINCT PCODE, min_lot, max_lot FROM plan) AS p
LEFT JOIN (SELECT LOT_CODE, PCODE, wip_chemicalweighing, wip_compounding, wip_extrusion, wip_forming, 
wip_deflashing FROM kanban_data ORDER BY PCODE) AS kd ON (p.PCODE = kd.PCODE)
LEFT JOIN (SELECT DISTINCT PCODE, count_wip_chemical_weighing, count_wip_compounding, count_wip_extrusion, count_wip_forming, 
count_wip_deflashing, kanban, virtual FROM kanban_checker ORDER BY PCODE) AS kc ON p.PCODE = kc.PCODE;

 

I need to distinct data FROM tables plan and kanban_checker.

 

Thank you..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.