How to Group data with same id in a join query |
Hello, please i have this in my controller
$pollModel = new Poll(); $polls = $pollModel->join('options', 'options.poll_id = polls.poll_id')->findAll(); if i loop through this it works but the problem is i have an option with same poll_id that is more than one.. so it loop them differently instead of making them one.. i also tried to use groupBy() $polls = $pollModel->join('options', 'options.poll_id = polls.poll_id')->groupBy('options.poll_id').findAll(); this is close to the answer but it only return just one option like if i have three option with same poll_id it only returns the first one.. Any help?? |
Welcome Guest, Not a member yet? Register Sign In |