![]() |
Denormalize a table or How to avoid records repeating in DB join - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Denormalize a table or How to avoid records repeating in DB join (/showthread.php?tid=12566) |
Denormalize a table or How to avoid records repeating in DB join - El Forum - 10-23-2008 [eluser]earlyriser[/eluser] Hi. I have the next tables and columns: BUSINESS: id, name CATEGORY: id, cat_name MIX: id, cat_id, business_id KEYWORD: id, keyword_name MIXK: id, keyword_id, business_id And what I need is to make a query for all the business in some category and get their related keyword, but I don`t know how to make the joins for the last part. I have this Code: $this->db->select('b.name, b.description, b.code, b.address, m.category_id, m.business_id'); What I get i all the business in the category that I want but the business are repeated for every keyword they are related. For example If I have just 1 business with 2 keywords (let's say "Best Western" as business and keywords: "cheap" "everywhere" I got 2 result rows and I would like to obtain just one. Thanks. |