![]() |
Avoid duplicate records on join - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Avoid duplicate records on join (/showthread.php?tid=77245) |
Avoid duplicate records on join - jose martin mbomio - 08-06-2020 Hi coders, i have a table name users id, id_role and mooore i have a table named roles id_role, name and more im using codelgniter . my poblem is that after join both tables im keep on having duplicate recored on display. im using this code for output users“s role option : Code: <div class="form-group "> // Model PHP Code: public function userRoles(){ thanks in advance RE: Avoid duplicate records on join - php_rocs - 08-06-2020 @jose martin mbomio, So basically you want to get rid of duplicate records in your query. You need to uncomment the group_by line and change 'users.role_id' to 'users.id'. Users can have many roles but there can only be one specific user id. |