on 11-06-2010 6:32 PM
Hola amigos buen dia.
Preguntandoles si hay manera de comparar solamente los meses en una fecha.
Lo que intento haces es compara las notas de credito que se hicieron en un mes pero que hayan cancelado unicamente facturas anteriores al mes que busque.
Se me ocurrio compara que el mes de la fecha de la nota de credito sea diferente al mes de la fecha de la factura.
Se podra.??
Hola...
Parte probando con el siguiente query...
SELECT DISTINCT T0.DocNum, T0.DocDate, T2.DocNum, T2.DocDate, T1.TrgetEntry, T0.DocEntry FROM ORIN T0 INNER JOIN INV1 T1 ON T1.TrgetEntry = T0.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocEntry
WHERE MONTH(T0.DocDate) != MONTH(T2.DocDate)
Espero te sea de ayuda
Saludos Cordiales,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hiola gracias me srivio de mucho. Aqui dejo el query de como quedo al final.
SELECT DISTINCT T3.[DocNum] 'Factura', T3.[DocDate] 'FechaFactura', T3.[CardCode] 'Codigo', T3.[CardName] 'Nombre', T0.[GrosProfit] 'SubTotal', T3.[VatSum]'Impuesto', T3.[WTSum]'Retencion', T3.[DocTotal]'Total Documento', T0.[DocNum] 'NotaCredito', T0.[DocDate] 'FechaNotaCredito' FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN INV1 T2 ON T1.[DocEntry] = T2.[TrgetEntry] INNER JOIN OINV T3 ON T2.[DocEntry] = T3.[DocEntry] WHERE (T0.[DocDate] BETWEEN [%0] AND [%1]) AND MONTH(T0.[DocDate]) != MONTH(T3.[DocDate]) ORDER BY T3.[DocNum]
Salu2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola, puedes utilizar la funcion DATEDIFF de SQL Server
SELECT DATEDIFF(month,'2010-10-05','2010-11-07') AS DiffDate
saludos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.