I'm a bit confused as to what you're trying to count and total. It
looks to me like you're now doing a count and price by item, whereas
before you wanted a grand total. IF you want a count and price by
item, you'd just do:

SELECT itemname, SUM(pricecolumn) as totalpricebyitem, COUNT(itemid)
AS countbyitem
FROM yourtables
group by itemname



On 7/12/05, daniel kessler <[EMAIL PROTECTED]> wrote:
> >When you ask Oracle to group by a particular column, it looks for like
> >values within that column and groups those rows of data together.
> >Let's look at some sample data.
> >
> >CustID      PricePaid             Date
> >1         .50                5/1/05
> >1         .75               5/7/05
> >2        1.00              6/1/06
> >2        .50                 5/1/05
> >
> 
> So, why  would I get the error, "not a group by expression" when I add a 
> column to the group by?  I receive this error freqently and never understand 
> why.  In this case, I'm using the food store unique id for each food item.
> 
> Also, since I'm asking, I'm trying to figure out how to get the number of 
> items in a grouped set or if they should not be grouped but instead sorted, 
> how do I get a count of those items.  In other words, I return a list of 
> purchased items.  I may have 4 drinks and 2 waters.  I want to list the 
> shopping cart just like that:
> 4 drink 6oz 3.19
> 2 water 32 oz 1.69
> 
> but I only know how to return a list.
> 
> Here's a picture of the current setup to hopefully make my explanation 
> clearer.
> http://eatsmart.umd.edu/activities/shopping_cart.gif
> under quantity in this case is just the food_item_id.  In this case  there 
> are only two unique items and in place of the current food_item_id, I'd like 
> to put the quantity of each item.
> 
> oh, I'm using the same query as displayed above, though on a different page 
> this time.
> 
> and sorry for all the DB questions, but I'm just out of my league today.  I'm 
> not really a TOTAL loser.
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:211643
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

Reply via email to