Club Delphi  
    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
  #1  
Antiguo 21-11-2008
sargento elias sargento elias is offline
Miembro
 
Registrado: mar 2008
Posts: 109
Poder: 17
sargento elias Va por buen camino
Ordenar una Sql con Union

Hola buenas tardes a todos, no soy muy experto en esto, y me gustaría saber cómo se puede ordenar ,por ejemplo por fecha esta sql , quiero hacerla funcionar en un query de Delphi7 (con Firebird 2.0)

Código SQL [-]
SELECT  'EXP' EXPE,M.DH,M.IMP,M.SDP,M.FEC,M.DES1, E.ID, substring(CODEXP from 1 for 4) || '/' ||
                                     substring(CODEXP FROM 5 FOR 2)  || '/' || 
                                     substring(CODEXP FROM 7 FOR 5) NUMEXP,  
                    C.DES CON 
                   FROM  EXPEMOV M 
                      INNER JOIN EXPEDIENTES E ON E.ID = M.IDEXP  
                       INNER JOIN CONCEPTOS C ON C.ID = M.IDCON  
 WHERE M.FEC BETWEEN FEC AND :HFEC 
 AND M.SDP = :SDP
 UNION    SELECT  'EXH' EXPE,M.DH,M.IMP,M.SDP,M.FEC,M.DES1, E.ID, substring(CODEXH from 1 for 4) || '/' ||
                                     substring(CODEXH FROM 5 FOR 2)  || '/' ||
                                     substring(CODEXH FROM 7 FOR 5) NUMEXP,
                    C.DES CON 
                   FROM  EXHMOV M
                      INNER JOIN EXHORTOS E ON E.ID = M.IDEXH
                       INNER JOIN CONCEPTOS C ON C.ID = M.IDCON  
 WHERE M.FEC BETWEEN FEC AND :HFEC 
 AND M.SDP = :SDP


Muchas gracias
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

Temas Similares
Tema Autor Foro Respuestas Último mensaje
¿ union ? Guillermo80 C++ Builder 6 02-03-2008 00:08:11
Select de un Union All?? Luana Tablas planas 1 17-04-2006 16:24:07
Como ordenar la UNION de 2 Consultas FIREBIRD pcicom SQL 2 10-02-2005 18:49:59
Union en BDE eduarcol SQL 9 05-07-2004 18:49:10


La franja horaria es GMT +2. Ahora son las 12:45:08.


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