Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    10

    Unanswered: 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

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •