registros de ayer
Publicado por Matias (4 intervenciones) el 16/04/2021 18:59:36
Buen dia gente, estoy intentando hacer una query donde me muestre los datos de ayer AUTOMATICAMENTE sin necesidad de meterle un between o un rango de fechas desde hasta, pero hasta el momento no doy en la tecla, necesito algo de ayuda.... gracias!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use DB
select
day(FECHA)AS DIA,
MONTH(FECHA)AS MES,
YEAR(FECHA)AS AÑO,
Neto= sum(fNetoFiscal1 + fNetoFiscal2 + fNetoFiscal3),
IVA21= Sum (FTAX0fiscal),
IVa105= Sum ( FTAX2fiscal),
TOTAL = SUM (fNetoFiscal1 + fNetoFiscal2 + fNetoFiscal3 + FTAX0fiscal + FTAX2fiscal), Count(*) Tickets,
Promedio=(( sum(fPrecioFiscal1 + fPrecioFiscal2 + fPrecioFiscal3+ISNULL(fTax1, 0)))/Count(*)), inrosuc, 'LALA' Sistema
from TABLA
where FECHA= (select MAX(FECHA) from TABLA)
and bstatus=0
group by inrosuc, day(FECHA), MONTH(FECHA), YEAR(FECHA)
order by day(FECHA) -1, MONTH(FECHA), YEAR(FECHA)
Valora esta pregunta


0