yes/no query question

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top