I am trying to SUM a column in oracle. The query works fine until I add the
SUM. It seems from the error, that I then have to have a GROUP BY. I guess I
don't understand how to use the GROUP BY in this instance or choose which
column to GROUP BY. I have googled around.
SELECT p.si_id,s.food_store_id,s.gs_price, SUM(s.gs_price) AS total_price
FROM fsnep_food_store_purchases p, fsnep_food_store
s,fsnep_food_store_game_info g
WHERE p.food_store_id = s.food_store_id
AND g.gi_id = #cookie.fsnep_bargain_hunt_gi_id#
GROUP BY p.si_id,s.food_store_id,s.gs_price
If I use all the columns listed in the SELECT, then I don't receive an error
but it doesn't seem to be the type of SUM that I'm expecting. For 15 records
listing their price I receive:
0.60
0.60
0.60
0.69
0.69
0.89
0.99
1.39
1.39
1.39
1.39
0.79
0.79
0.79
0.79
total price:0.60
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211596
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54