Please help |
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??
@devprecious ,
When you do a group by it consolidates similar columns that is why you only get one record. Try orderBy()
@devprecious ,
No, it will order all of the records by the fields you list in the order by function.
That wasn't what I wanted.. have solved it tho, thanks
I used array_map() I don't know how to post the image here.. but it's solved now
@devprecious ,
Awesome. Glad to here it. Could you please hit the Solved button. This will tell everyone that this issue has been resolved. Thx |
Welcome Guest, Not a member yet? Register Sign In |