Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 21-04-2008
Avatar de jachguate
jachguate jachguate is offline
Miembro
 
Registrado: may 2003
Ubicación: Guatemala
Posts: 6.254
Poder: 30
jachguate Va por buen camino
Bueno, compañeros... eso depende de las capacidades del motor. Si es oracle, firebird 2.0 o SQL Server, podrías hacer esto, que suelen llamar inline views o tablas derivadas:

Código SQL [-]
select q1.total_gordo, q1.total_general, 100 * q1.total_gordo / q1.total_general
  from (  
      Select sum(l.lin_kgsnetos) Total_gordo, 
               (Select sum(lin_kgsnetos) from lineas_entrada l2 where l2.lin_socio = l.lin_socio) total_general,
        from lineas_entrada l
       where lin_socio = 4
         and lin_variedad = 'GORDO'
  ) q1;

Hasta luego.

__________________
Juan Antonio Castillo Hernández (jachguate)
Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 15:56:01.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi