Bob Kruger <bkruger(at)mindspring(dot)com> writes:
> I would like to be able to do a query in which I can list all of the
> vehicles and a totalization of the costs, e.g. list one vehicle number, and
> the sum of costs for that vehicle.
I think you want GROUP BY, eg
select veh_no, sum(cost) from table group by veh_no;
sum() and other aggregates apply across a group, not across the whole
table, when you use GROUP BY. Notice you do NOT use DISTINCT ...
GROUP BY takes care of that for you.
regards, tom lane