Frank Rocco
|
Posted: 05/22/2001, 10:24 AM |
|
Hello,
In codecharge I want to select fld1, fld2, sum(fld3) and group on fld1 and
total the sum(fld3)
fld1 fld2 Sum(fld3)
AA BB 100
AA SS 200
Break---- 300
How is this done?
I no this is not a codecharge problem, but need advise.
Can you point me to a link where I can get more knowledge of this?
Thanks
Frank
|
|
|
Walker P.
|
Posted: 05/23/2001, 9:21 AM |
|
Frank,
the Bookstore example application which comes bundled with CodeCharge has
some SQL statements which perform computations like you mentioned. If you
look at the SQL tab of the 'Items' form in the 'ShoppingCart' page, you will
see a SQL statement:
select order_id, name, price, quantity, member_id, quantity*price as
sub_total
from items, orders where orders.item_id=items.item_id order by order_id
which performs a multiplication operations. The 'Total' form in the same
page has another SQL statement:
select member_id, sum(quantity*price) as sub_total from items, orders where
orders.item_id=items.item_id
group by member_id
which performs multiplication and summation. If you want to learn more about
SQL operations, I would advice you to get a hold of a good SQL book or look
at online resources such as www.informit.com.
Regards.
Walker P.
CodeCharge Support
|
|
|
|