I am using CodeIgniter and I am trying to do it in the following way:
$query = $this->db->query("SELECT Tabla1.id
From Tabla1 INNER JOIN Tabla2
ON Tabla1.id = Tabla2.id");
if($query->num_rows()>0){
foreach ($query2->result_array() as $row){
echo $row['id']."<br>";
}
So far, if I can get a list with all the ids in Table1 but I need to compare each one of those id in the next query, the problem is that I do not know how to save them.
SELECT Tabla1.campo1, Tabla1.campo2, Tabla1.campo3
From Tabla1, Tabla2, Tabla3
WHERE Tabla1.campo2= Tabla2.campo2
AND Tabla2.campo3 = Tabla3.campo3
AND Tabla2.campo3 = $row['id']