The column 'codnoticia' is ambiguous, when preparing: SELECT COUNT(*) as total FROM [App\Models\Noticia] JOIN [App\Models\NoticiaIdioma] AS [ni] ON App\Models\Noticia.codnoticia = ni.codnoticia JOIN [App\Models\Idioma] AS [i] ON i.codidioma = ni.codidioma AND i.sigla = :idioma: LEFT JOIN [App\Models\Advogado] AS [a] ON a.codadvogado = App\Models\Noticia.codadvogado WHERE publicado = 1 and codnoticia in (
                        select App\Models\NoticiaMenuItem.codnoticia
                          from App\Models\NoticiaMenuItem
                         where App\Models\NoticiaMenuItem.codmenuitem = ?0
                    )