You are on page 1of 1

CREATE VIEW Ventas

WITH SCHEMABINDING
AS SELECT
M.Municipio
, M.Latitud
, M.Longitud
, (C.nombres + ' ' + C.apellidos) AS Cliente
, F.fechaFactura
, YEAR(F.fechaFactura) AS Año
, MONTH(F.fechaFactura) AS Mes
, P.Producto
, CT.Categoria
, (P.Precio * P.Existencia) AS Total
FROM Municipio AS M
INNER JOIN Cliente AS C
ON (M.idMunicipio = C.idMunicipio)
INNER JOIN Factura AS F
ON (F.idCliente = C.idCliente)
INNER JOIN Producto AS P
ON (P.idProducto = C.idCliente)
INNER JOIN Categoria AS CT
ON (P.idCategoria = CT.idCategoria) WHERE M.Municipio = 'Altagracia';

You might also like