Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #8  
Antiguo 29-05-2019
Avatar de mRoman
mRoman mRoman is offline
Miembro
 
Registrado: nov 2003
Posts: 646
Poder: 23
mRoman Va por buen camino
Pues quedó asi:

Código SQL [-]
select LPAD(a.registro_id,6,'0') as registro_id,
       LPAD(a.folio_ticket_comanda,6,'0') as ticket,
       a.registro_id as registro_id2,
       current_date  as fecha_hora_impresion,
       a.mesa_num||COALESCE(a.literal,'') as mesa,
       CASE
           when EXTRACT(HOUR from current_time) >=13 then SUBSTR(a.fecha_hora_registro,1,19)
       ELSE EXTRACT(year FROM a.fecha_hora_registro)||'/'||
            LPAD(EXTRACT(month from a.fecha_hora_registro),2,0)||'/'||
            LPAD(EXTRACT(day from a.fecha_hora_registro),2,0)
       END as fecha_comanda,
       b.cantidad,
       b.consec,
       case b.cortesia
           when 'S' then b.precio*-1
           when 'N' then b.precio
       end as precio,
       b.comentario,
       CASE b.cortesia
          when 'S' then RTRIM( UPPER(c.prod_descripcion_corta) )||'-[CORTESIA]'
          when 'N' then RTRIM(UPPER(c.prod_descripcion_corta))
       end||' '||COALESCE(b.comentario,'') as prod_descripcion_corta,
       b.descripcion_producto,
       b.cortesia,
       UPPER((select d.alias_nombre
        from empleado d, asignacion_mesa e
        where d.empleado_id=e.empleado_id
          and e.mesa_num=a.mesa_num)) as mesero,
       f.um_descripcion_corta,
       h.descripcion as clasificacion
from comanda_maestro a,
     comanda_detalle b,
     producto c,
     unidad_medida f,
     categoria_producto g,
     clasif_categoria_producto h
where a.registro_id=b.registro_id
  and a.registro_id=:registro_id
  and b.producto_id=c.producto_id
  and c.um_id=f.um_id
  and c.categoria_id=g.categoria_id
  and g.id_clasificacion=h.id_clasificacion
order by h.descripcion

La parte azul es como quedó la consulta. Gracias a todos por su tiempo y sus aportaciones.
__________________
Miguel Román

Afectuoso saludo desde tierras mexicanas....un aguachile?, con unas "cetaseas" bien "muertas"?, VENTE PUES !!
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
Sentencia Case... error Incompatible types BlueSteel Varios 5 05-10-2010 21:53:30
Sentencia CASE en SQL Server juanelo MS SQL Server 13 26-02-2010 14:19:47
Es posible un Case anidado en Sentencia SQL ? gluglu SQL 3 25-09-2007 20:43:15
sentencia case... patorecalde Oracle 2 07-08-2007 20:55:57
Cast a un Blob Triton Firebird e Interbase 0 20-02-2004 09:49:53


La franja horaria es GMT +2. Ahora son las 03:40:21.


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