Could you help me create a query through a Stored Procedure? to select Sales with:
-
pClient (only when it is not null)
-
pProduct (only when it is not null)
-
pSeller (only when it is not null)
-
List of Sales (p From, PHase, Customer, Product, Salesperson)
ifnull pCliente then cSqlCliente="" else cSqlCliente="and Cliente= pCliente " fnull pProducto then cSqlProducto="" else cSqlProducto="and Producto= pProducto " ifnull pVendedor then cSqlVendedor="" else cSqlVendedor="and Vendedor= pVendedor " cSqlSelect:= "Select * from Ventas where fecha between pDesde and pHasta "+ cSqlCliente+ cSqlProducto+ cSqlVendedor Exec( cSqlSelect)