newphpcoder Posted February 29, 2012 Share Posted February 29, 2012 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.. Quote Link to comment https://forums.phpfreaks.com/topic/257962-select-distinct-from-left-join/ Share on other sites More sharing options...
Muddy_Funster Posted February 29, 2012 Share Posted February 29, 2012 Does changing your last LEFT JOIN to an INNER JOIN help? Quote Link to comment https://forums.phpfreaks.com/topic/257962-select-distinct-from-left-join/#findComment-1322219 Share on other sites More sharing options...
newphpcoder Posted February 29, 2012 Author Share Posted February 29, 2012 No.... Quote Link to comment https://forums.phpfreaks.com/topic/257962-select-distinct-from-left-join/#findComment-1322229 Share on other sites More sharing options...
Muddy_Funster Posted February 29, 2012 Share Posted February 29, 2012 ok, could you give a more accurate description of what exactly you are trying to return? Quote Link to comment https://forums.phpfreaks.com/topic/257962-select-distinct-from-left-join/#findComment-1322233 Share on other sites More sharing options...
newphpcoder Posted February 29, 2012 Author Share Posted February 29, 2012 this is link with the whole code: http://www.phpfreaks.com/forums/index.php?topic=354736.new;topicseen#new Quote Link to comment https://forums.phpfreaks.com/topic/257962-select-distinct-from-left-join/#findComment-1322234 Share on other sites More sharing options...
fenway Posted March 3, 2012 Share Posted March 3, 2012 And you're posting this thread twice because...? Quote Link to comment https://forums.phpfreaks.com/topic/257962-select-distinct-from-left-join/#findComment-1323495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.