join sql help - 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: join sql help (/showthread.php?tid=42883) |
join sql help - El Forum - 06-22-2011 [eluser]mattylux[/eluser] hello This is my controller and I would like connects the two tables with join sql but I have never done I'd need some advice. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); the two tables are called for the database catalogo and generi in my library Table is in the catalog are: id, codice_bilbioteca, autore_nome, autore_cognome, title, series publication. genres in the table: id and kind. how can I do to relate them libri_model Code: <?php thanks join sql help - El Forum - 06-22-2011 [eluser]osci[/eluser] since you 've never did a join before I suggest you read PHP Manual - Join. If you think it's too much read http://www.tizag.com/sqlTutorial/sqljoin.php which covers basic usage, but I still recommend you should read the first too. join sql help - El Forum - 06-23-2011 [eluser]skeletonfriend[/eluser] You need to have a foreign key in the Catalog table that references the Genre table in order to make a join. Code: $this->db->from('catalogo'); |