Shipping Table - Neighborhood Listing

0

I have a table named bairro :

Ihaveatablenamedtabelafrete:

I have the following SQL

public function getBairroList()
{       
    $sql = "SELECT * FROM bairro as b Left join tabelafrete as t on b.idBairro = t.idDestino where t.idSaida = 1";
    return $this->db->query($sql)->result();    
}

Where t.idSaida = 1 (1 = exit neighborhood)

It works as follows: A race from the Centro district - Up to the Abranches neighborhood, it costs for the table, 2 points. Thus, output = 1, 2 = arrival ... But while I list all neighborhoods, appears only what is already filled in the shipping table.

Need: LIST all neighborhoods, even if you have not completed the fields ... so so, you need not register one by one

.

I need it to be this way: Can anyone help me?

    
asked by anonymous 10.06.2015 / 04:38

1 answer

1

I think your SQL looks something like this:

SELECT * 
FROM bairro as b 
Left join tabelafrete as t on b.idBairro = t.idDestino and t.idSaida = '".$id."
    
10.06.2015 / 06:26