Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Question Unanswered: Stored Procedure checking 2 tables

    ok, ill lay it out like this, and try not to be too confusing.

    I need to check my trasaction table to see that the user with a UserID bought, keeping track(adding up) of how many times they bought the Product with a productID, , then i need to selcect items from product table with the productID for the items the user bought,

    i know how to return the product information, and how to check the tranaction table and i think how to add up the amount of tranastions for that item

    so bacially i need to select data from a product table, for the products that the user bought tahts stored in the transaction table.

    well i tried not to be confusing, but i think i failed

  2. #2
    Join Date
    Dec 2002
    Antwerp, Belgium
    create procedure sp_yourproc 
    @pUserID int
    select distinct
       products.ProdID, products.col1, products.col2
       products inner join
       transactions on products.ProdID = transaction.ProdID
       transactions.UserID = @pUserID
    In this stored procedure you will provide the userID as parameter and it will return columns from the products table that are bought by that user.

Posting Permissions

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