Group by Query help from multiple tables - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Group by Query help from multiple tables (/showthread.php?tid=73521) |
Group by Query help from multiple tables - jTam - 05-03-2019 Hello, I need help in a query from multiple tables. Here are the table names:- products images (for product's images) users
Here is the query I have been trying:- Code: public function random_three_sellers(){ 3. Is it possible to add total number of followers per user. This data is in another table named "followers" , the column is "following_id" 4. Finally, how to show them in the view's loop? Please ask me if any more info is required for the solution. Regards. RE: Group by Query help from multiple tables - php_rocs - 05-03-2019 @jTam, if you give me the table definitions (and test data for each of the 4 tables-products, images,users and followers) then I can use http://sqlfiddle.com/ to help you figure it out. RE: Group by Query help from multiple tables - jTam - 05-04-2019 Hello php_rocs, Thank you for reply. The tables are connected by these columns: products (id) -> images (product_id) products (user_id) -> users (id) users (id) -> followers (following_id) Edit: uploaded test data "sql" file .. I can not see the uploaded file. So sharing link from googledrive. https://drive.google.com/open?id=1tuctBnp1Hyix3JDuer7lBppdViMWcLPm |