>>SELECT a.ccompania_id as cia,'*' as oficina, a.cproveedor_id as Movi, b.cvehiculo_placa as Placa,b.cvehiculo_chofer as Chofer >> FROM [bdmain].[dbo].[_proveedor] a,[ventas].[dbo].[_vehiculo] b >> where ctipo_proveedor_id='05' >>and cestado_prov_id='A' >>and a.cproveedor_id=b.cproveedor_id >>>>and another one wich summarizes all the customers and orders the vehicle has to deliver.
>>select cid_transportista, COUNT (distinct cid_clie) As clientes, >> COUNT(*) as Ordenes ,SUM(npeso_total_documento) as peso, >> MAX(cnro_guia_remision) as guia >> from _movimiento_ventas where cestado_documento_id='I' and ctipo_documento_id in ('FA','BO','TK') group by cid_transportista >> >>>>