I'm currently working on a query which pulls out all the items from a trolley that a user has added. The below code demonstrates what I am trying to achieve, where I take all the trolley items and total the quantity up, aswell as multiplying the cost + quantity of each item against eachother and summing those up too. I also want to be able to call out bog standard column names from this query. I'm not too sure about how I can do this other than create 3 queries, one for the trolley itself, one for the total amount of items for the user and one for the total cost of user, however surely it can all be done in one query right?
<cfquery datasoure="#application.datasource#" name="trolley">
Select *, IsNull(Sum(trolley_amount), 0) As trolly_items, IsNull(Sum(trolley_cost * trolley_amount), 0) As trolley_totalcost
From trolley
</cfquery>