Вы находитесь на странице: 1из 2

TABLAS ORIGEN

Las dos tablas estn a nivel Factura, Local, Fecha, producto


JCML_Gasto de Ventas
Local
L001
L002

Fecha
Num_Factura
11/1/2014 001-10004
11/2/2014 001-10005

Gasto
S/.
10.00
S/.
30.00
S/.
40.00

JCML_Ventas
Local
L001
L001

Fecha
Num_Factura
11/1/2014 001-10004
11/1/2014 001-10004

Producto
P001
P002

Venta
S/.
150.0
S/.
200.0
S/.
350.0

P003
P004
P005

S/.
S/.
S/.
S/.

Venta
S/.
S/.
S/.
S/.
S/.

Gasto_Distrib
4.29
5.71
8.60
11.60
9.80
S/.
40.00

L002
L002
L002

11/2/2014 001-10005
11/2/2014 001-10005
11/2/2014 001-10005

400.0
540.0
456.0
1,396.0

TABLA DESTINO
Consolidado o agrupado a nivel Local, Fecha, producto.
JCML_VENTAS_GASTO_DISTRIBUIDO
Local
Fecha
L001
11/1/2014
L001
11/1/2014
L002
11/2/2014
L002
11/2/2014
L002
11/2/2014

Producto
P001
P002
P003
P004
P005

150.0
200.0
400.0
540.0
456.0

Consulta Final de la tabla destino JCML_VENTAS_GASTO_DISTRIBUIDO


Mostrar las ventas agrupadas por local y da, cuyo total de venta (por local) sea mayor a 400

Peso
Gasto_Distrib
0.42857143
4.28571429
0.57142857
5.71428571
1
S/.
10.00

0.28653295
0.38681948
0.32664756
S/.
1

ea mayor a 400

8.60
11.60
9.80
30.00

Local
Fecha
Num_Factura
Producto
Venta

Вам также может понравиться