Welcome Guest, Not a member yet? Register   Sign In
Problem with Join and LIMIT
#1

[eluser]Halan Batista[/eluser]
Hello! How are u?

Well..

I have a serious problem with a JOIN.

Here my code below:

Code:
//query
        $row = $this->db->select("
                    publicacao.id_artigo,
                    publicacao.id_categoria,
                    publicacao.permalink,
                    artigo.titulo,
                    artigo.sub_titulo,
                    categoria.descricao AS descricao_categoria,
                    categoria.permalink AS permalink_categoria,
                    imagens.titulo AS titulo_foto,
                    imagens.caminho
                    ")
                ->where('publicacao.id_sub_categoria', $id_sub_categoria)
                ->where('publicacao.destaque_telao', '1')
                ->join('artigo', 'artigo.id = publicacao.id_artigo', 'left')
                ->join('categoria', 'categoria.id = publicacao.id_categoria', 'left')
                ->join('imagens', 'imagens.id_artigo = publicacao.id_artigo', 'left')
                ->order_by('imagens.ordem', 'asc')
                ->get('publicacao', 5);
                
        //retorna resultado
        return $row;


My question is that I return 5 registered items, but I do a JOIN to the table and that table IMAGES I need that returns only one image, how do I solve this problem?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB