detr820 Posted August 16, 2013 Share Posted August 16, 2013 Como hago para filtrar valores null, estoy tratando de crear un reporte mensual a partir de la fecha, esta la convierto a mes pero hay algunas lineas que no tienen fecha y estas al hacer la conversion a mes me arroja valor NULL, necesito dejar todos los valores menos los null.(123 null; 456 enero; ...; 789 diciembre) ahora(456 enero; ...; 789 diciembre) lo que necesitoEste query es la ultima version de los que he probado:selectsum(account_invoice.amount_total), case to_char(date_invoice,'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when '12' then 'Diciembre' when IS NULL then 'Nulo' endfrom account_invoicegroup bycase to_char(date_invoice,'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when '12' then 'Diciembre' when IS NULL then 'Nulo' end[/code] Gracias por la ayuda Link to comment Share on other sites More sharing options...
djohnson53 Posted August 17, 2013 Share Posted August 17, 2013 English: How do I filter out null values, I'm trying to create a monthly report from the date this convert it to month but there are some lines that are not dated and these to make the conversion to NULL month throws me, I need to leave all under the null values.(123 null, 456 in January, ..., December 789) now(January 456, ..., 789 December) I needThis query is the latest version of the ones I tried: {sql query} Thanks for the help Link to comment Share on other sites More sharing options...
detr820 Posted August 17, 2013 Author Share Posted August 17, 2013 Casi resolvi el problema sustituyendo "(date_invoice, 'mm')" por "coalesce(date_invoice, currente_date), 'mm')".Estoy usando Openerp para facturar, en este sistema se crea un pedido de ventas y luego se manda a facturar, cuando el documento llega al modulo de facturacion la fecha queda en blanco hasta que la persona encargada imprime la factura.Lo que me queda es ordenar por mes, pero cuando lo hago me crea varias lineas un mismo mes, sin el order by, quedan agrupados pero no en orden.SELECTcase to_char(coalesce(date_invoice, current_date),'mm')when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when'12' then 'Diciembre' end as mes,sum(case type when 'out_invoice' then amount_untaxed else -amount_untaxed end) as ventaFROMaccount_invoice where type in ('out_invoice','out_refund')group bycaseto_char(coalesce(date_invoice, current_date),'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04'then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07'then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when'10' then 'Octubre' when '11' then 'Noviembre' when '12' then'Diciembre' end [/code] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now