newphpcoder Posted February 27, 2012 Share Posted February 27, 2012 Hi.. I encountered problem in my query to display data. here is my separate query then i mix up: SELECT kc.PCODE, 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, p.max_lot, p.min_lot FROM kanban_checker kc JOIN plan p ON kc.PCODE = p.PCODE ORDER BY p.PCODE; SELECT kd.LOT_CODE, kd.wip_chemicalweighing, kd.wip_compounding, kd.wip_extrusion, kd.wip_forming, kd.wip_deflashing FROM kanban_data kd JOIN plan p ON kd.PCODE = p.PCODE ORDER BY p.PCODE; mix query SELECT p.PCODE, 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, p.max_lot, p.min_lot FROM kanban_data kd JOIN kanban_checker kc ON kd.PCODE = kc.PCODE JOIN plan p ON kc.PCODE = p.PCODE ORDER BY p.PCODE; I want to display PCODE once. like one P35, one P35M .I want it to display with the 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, p.max_lot, p.min_lot,...No PCODE and max_lot, virtual, min_lot, kanban in this fields: kd.LOT_CODE, kd.wip_chemicalweighing, kd.wip_compounding, kd.wip_extrusion, kd.wip_forming, kd.wip_deflashing I attach the sample format I need to display which is the excel type and the html type the result from query. Thank you 17639_.zip Quote Link to comment https://forums.phpfreaks.com/topic/257859-problem-in-joining-three-tables/ Share on other sites More sharing options...
kickstart Posted February 27, 2012 Share Posted February 27, 2012 Hi Not quite sure how you want to derive the fields. However it looks like you want to use aggregate fields (ie, MIN, MAX, etc) with a GROUP BY clause. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/257859-problem-in-joining-three-tables/#findComment-1321624 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.