Estimado Carlitos (tocayito):
Necesitas un total por cada rango de antiguedad (o edad)?
Podrías hacer algo asi (probalo)
SELECT IIF( BETWEEN( DATE()-fecha, 0, 30 ), 1,;
IIF( BETWEEN( DATE()-fecha, 31, 60 ), 2,;
IIF( BETWEEN( DATE()-fecha, 61, 90 ), 3, 4 ) ) ) AS 'Edad',;
SUM( importe - descuento );
FROM tutabla GROUP BY 1 ORDER BY 1
Controlá que los parentesis estén bien, si no era esa la duda, amplia la
pregunta.
Saludos: Carlos Miguel
[EMAIL PROTECTED] escribió:
@font-face { font-family: Wingdings; } @font-face { font-family:
Cambria Math; } @font-face { font-family: Calibri; } @font-face {
font-family: Tahoma; } @font-face { font-family: Webdings; } @page
Section1 {size: 612.0pt 792.0pt; margin: 70.85pt 3.0cm 70.85pt 3.0cm; }
P.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New
Roman","serif" } LI.MsoNormal { FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt;
FONT-FAMILY: "Times New Roman","serif" } DIV.MsoNormal { FONT-SIZE: 12pt;
MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman","serif" } A:link {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99 }
SPAN.MsoHyperlink { COLOR: blue; TEXT-DECORATION: underline;
mso-style-priority: 99 } A:visited { COLOR: purple; TEXT-DECORATION:
underline; mso-style-priority: 99 } SPAN.MsoHyperlinkFollowed { COLOR:
purple; TEXT-DECORATION: underline; mso-style-priority: 99 }
SPAN.EstiloCorreo17 { COLOR: #1f497d;
FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal }
SPAN.EstiloCorreo18 { COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif";
mso-style-type: personal } SPAN.EstiloCorreo19 { COLOR: #1f497d;
FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply }
.MsoChpDefault { FONT-SIZE: 10pt; mso-style-type: export-only }
DIV.Section1 { page: Section1 } colegas
tengo una bdatos que tiene los sgtes campos
expediente, nombre, fecha,comprobante, importe, descuento
(tengo una consulta que resta el campo (importe-descuento) y este campo
quiero que este en un reporte o consulta que me de un saldo por edades (0-30,
30-60, 60-90, +90dias)
a lo mejor ustedes lo hacen diferente y obtienen el mismo resultado que yo ,
la verdad es que no se como hacerlo.
un saludo
carlitos
---------------------------------
¡Buscá desde tu celular!Yahoo! oneSEARCH ahora está en Claro
http://ar.mobile.yahoo.com/onesearch