G
Guest
hi,
bad table design. sorry.
i would have set it up to have amount and type.
that way i could use the aggragate function sum to sum the
amount and group by on the type. that would give me the
sum of all three types.
amount type
100 gas
56 clear
245 dryed
50 gas
Select Sum(tbl.amount)as amount, type from tbl group by
tbl.type;
results
amount type
150 gas
50 clear
245 dryed
the way you have it, it looks like you may have to write 3
seperate querys to sum each type and if you need the
results of further processes, put those 3 queries in a
fourth query for totals.
bad table design. sorry.
i would have set it up to have amount and type.
that way i could use the aggragate function sum to sum the
amount and group by on the type. that would give me the
sum of all three types.
amount type
100 gas
56 clear
245 dryed
50 gas
Select Sum(tbl.amount)as amount, type from tbl group by
tbl.type;
results
amount type
150 gas
50 clear
245 dryed
the way you have it, it looks like you may have to write 3
seperate querys to sum each type and if you need the
results of further processes, put those 3 queries in a
fourth query for totals.