Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Blastrix
Posting Yak Master
208 Posts |
Posted - 2001-07-04 : 13:07:46
|
| How would one go about creating a query that will do the following? I have a shopping cart program, and the client wants to have the ability for their customers to click on one button, and have all of the items for the bike ordered. They don't have a specific part number for this, so it can't just be added like a regular part. To keep things nice, orderly, and readable. If a part is being added to the cart and it already exists, then the quantity of the existing part is just modified.How could I build a query to do this but while adding 10 different parts at one time? Getting which parts to add is not a problem, it's just determining if they should be inserted, or just have a quantity updated.@bikeId -- Which bike we want to snag all parts for.@cartId -- Which cart to add to@qty -- Quantity to addTable 'bikes'bikeId -- Unique IDTable 'products'partId -- Unique IDbikeIdTable 'shopping_cartItems'slotId -- Unique IDcartIdpartIdpartQty |
|
|
|
|
|