Ver Mensaje Individual
  #14  
Antiguo 03-09-2004
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Reputación: 24
guillotmarc Va por buen camino
Hola.

Aqui tienes el mismo resultado, aunque con solo dos subconsultas, por lo que el rendimiento tiene que ser óptimo.

Código SQL [-]
select MAX.TOPE as MAX_TOPE, MAX.TOPELISTA as MAX_TOPELISTA, MAX.TOPEMAY as MAX_TOPE_MAY,
         MIN.TOPE as MIN_TOPE, MIN.TOPELISTA as MIN_TOPELISTA, MIN.TOPEMAY as MIN_TOPE_MAY
from RDB$DATABASE
inner join TABLA1_MARCAS MAX where TOPE = (select max(TOPE) from TABLA1_MARCAS where MARCA = 'CAJAS 44' and GRUPO = 'CARTON') and
                                                     MARCA = 'CAJAS 44' and GRUPO = 'CARTON'
inner join TABLA1_MARCAS MIN where TOPE = (select min(TOPE) from TABLA1_MARCAS where MARCA = 'CAJAS 44' and GRUPO = 'CARTON') and
                                                     MARCA = 'CAJAS 44' and GRUPO = 'CARTON'

Saludos.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).
Responder Con Cita