A sql subquery |
[eluser]alvaroeesti[/eluser]
Hello, I have got this, alright Code: $this->db->where('paises.id_pais', $paises); or in other wordshow do I do this: Code: select nombre_pais from paises where id_pais = $paises thank you
[eluser]NotDior[/eluser]
I'd do this...it will get you more than what you need, but it will also get you what you need. $this->db->get_where('paises',array('id_pais'=>$paises)); http://ellislab.com/codeigniter/user-gui...ecord.html
[eluser]alvaroeesti[/eluser]
but that is going to get me all the values of all the columns of the row, and I would want just the name of the country, i think smth like this would do Code: $this->db->select('nombre_pais FROM paises WHERE paises.id_pais = $paises');
[eluser]NotDior[/eluser]
In that case I'd use the $this->db->query() command which will allow you to write out the SQL code that you need/want. There's probably another way to do it with active record, but I'm not that familiar with it. So something like this: Code: $sSelectSQL = "select nombre_pais from paises where id_pais = $paises"; |
Welcome Guest, Not a member yet? Register Sign In |