Ver originalSELECT A.categorias as nombrecategoria, R.cat_id as categoria, S.cat_id as subcategoria FROM articulos A LEFT OUTER JOIN categorias R ON R.categoria_asoc = 0 AND A.categoria = R.cat_id LEFT OUTER JOIN categorias S ON S.categoria_asoc != 0 AND A.subcategoria = S.cat_id