Ayuda Consulta
Publicado por Benito (1 intervención) el 03/06/2009 13:25:05
Hola soy nuevo en lenguaje SQL i me gustaria que alguien me ayudase en esta consulta.
Mi código es el siguiente:
select SUM(Alb.N_ArticleVenut * Art.Preu) as region, F.Nom_Fabricant
from Albara Alb, Articles Art, Venda V, Fabricant F
where V.Codi_Albara=Alb.Codi_Albara and F.Codi_Fabricant= v.Codi_Fabricant
and Alb.Codi_Article= Art.Codi_Article
group by F.Codi_Fabricant
y el resultado:
region Nom_Fabricant
--------- ----------------
1403,7 Manuel
455,6 Joan
1332,72 Juanjo
2345,22 Simón
Y me gustaría sólo escoger el grupo que tiene el valor máximo. En este caso seria "2345,22 Simón".
Lo he intentado de distintas formas pero ninguna con exito, si alguien me puede ayuda me haría una gran favor.
Grácias de antemano.
Mi código es el siguiente:
select SUM(Alb.N_ArticleVenut * Art.Preu) as region, F.Nom_Fabricant
from Albara Alb, Articles Art, Venda V, Fabricant F
where V.Codi_Albara=Alb.Codi_Albara and F.Codi_Fabricant= v.Codi_Fabricant
and Alb.Codi_Article= Art.Codi_Article
group by F.Codi_Fabricant
y el resultado:
region Nom_Fabricant
--------- ----------------
1403,7 Manuel
455,6 Joan
1332,72 Juanjo
2345,22 Simón
Y me gustaría sólo escoger el grupo que tiene el valor máximo. En este caso seria "2345,22 Simón".
Lo he intentado de distintas formas pero ninguna con exito, si alguien me puede ayuda me haría una gran favor.
Grácias de antemano.
Valora esta pregunta


0