close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How do you sum column values on a results page after a search query?

Thread began 10/28/2013 10:14 pm by ninetyplus | Last modified 11/05/2013 2:15 pm by ninetyplus | 1404 views | 6 replies


Thanks Jason. The problem I'm encountering is when I add a SUM function, it only returns 1 record. If I add a GROUP BY function such as the contract ID (npc_id), It doesn't SUM up the column values like my bag quantities (bag_qty). I attached the file I'm working on to the previous post but here is my SQL statement for the recordset I'm looking to get SUM results on.

"SELECT *,SUM(bag_qty) as TotalBags, (bag_qty*bag_weight) as TotalKg, (landed_price*2.2046) as KGprice, (bag_qty*bag_weight*2.2046*landed_price) as TotalContractPrice, Coalesce((twenty_five_paid_ci+spot+seventy_five),0) as BalanceDue FROM npc_contract LEFT OUTER JOIN clients ON npc_contract.client_id=clients.ClientID LEFT OUTER JOIN inventory ON npc_contract.coffee_id=inventory.inventory_id LEFT OUTER JOIN warehouse ON npc_contract.destination_port=warehouse.WarehouseID LEFT OUTER JOIN np_agents ON npc_contract.agent=np_agents.agentID WHERE inventory_year >= '2013' ORDER BY npc_id DESC"

The example above is just testing the SUM function of the bag quantites: SUM(bag_qty) as Total Bags. What I want to be able to do is sum the total values of certain columns after I have preformed a search.

Thanks Jason.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...