If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Sum function sql statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-09, 07:12
peggie1990 peggie1990 is offline
Registered User
 
Join Date: Jun 2009
Posts: 10
Sum function sql statement

Currently I am doing a shopping cart and I need to make use of inner join statement to display the details.

However my table is in the form of inner join.

The two database that I make use of is called:
shoppingcartitems
Products
I link them together by using the productId

My shoppingcartitems attributes are:
SCId
UserId
ProductId
Quantity

My products attributes are:
ProductId
ProdName
ProdColor
ProdDesc
UnitPrice
Quantity
ProdCatId
UserId
ProdImage

The shopping cart will display ProdImage, UnitPrice, ProductName, quantity and TotalPrice(But i dont know how to write the sql statement that sum the unit price from the database)

Thanks
Reply With Quote
  #2 (permalink)  
Old 08-10-09, 07:37
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,258
select my,column,list, shoppingcartitems.Quantity * Products.UnitPrice as itemCost from my table
join.....


ofcourse you could just do the calcualtion in the front end.. y'don't have to do it in the query if you don't weant to.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On