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
  #2  
Antiguo 17-11-2018
Avatar de Casimiro Noteví
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.669
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
Si es una sola tabla, quita todo lo de FAC_CREDITO.
Código SQL [-]
select
ID_CLIENTE,
ID_FACTURA,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE ) <0 AND (FECHAFIN_CRE <> '0000-00-00' ), M_VENTACREDITO,0) AS POR_VENCER,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=0 AND DATEDIFF( month, current_date, date FECHAFIN_CRE  ) <=15 OR FECHAFIN_CRE = '00-00-0000', M_VENTACREDITO,0) AS VENCIDOS115, 
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=16 AND DATEDIFF( month, current_date, date FECHAFIN_CRE ) <=30, M_VENTACREDITO,0) AS VENCIDOS1630,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=31 AND DATEDIFF( month, current_date, date FECHAFIN_CRE ) <=45, M_VENTACREDITO,0) AS VENCIDOS3145,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=46 AND DATEDIFF( month, current_date, date FECHAFIN_CRE ) <=60, M_VENTACREDITO,0) AS VENCIDOS4660,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=61 AND DATEDIFF( month, current_date, date FECHAFIN_CRE ) <=90, M_VENTACREDITO,0) AS VENCIDOS6190,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=91 AND DATEDIFF( month, current_date, date FECHAFIN_CRE ) <=120, M_VENTACREDITO,0) AS VENCIDOS91120,
IIF( DATEDIFF( month, current_date, date FECHAFIN_CRE )>=121 ,M_VENTACREDITO,0) AS VENCIDOSMAS120
from FAC_CREDITO
ORDER BY ID_CLIENTE

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
forma de programar no se si es la correcta ? gulder MySQL 4 05-04-2016 17:49:51
Creacion Correcta de Forms??? jbautista Varios 7 27-05-2010 16:48:29
Pronunciación correcta. marcoszorrilla La Taberna 1 12-11-2008 21:38:25
Problema con consultas DateDiff enecumene MySQL 1 07-12-2007 18:35:03
La elección correcta ! Xianto Tablas planas 2 07-01-2005 12:35:24


La franja horaria es GMT +2. Ahora son las 09:23:07.


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