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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 merging two queries... sounds simple!

Author  Topic 

wahmann
Starting Member

2 Posts

Posted - 2000-09-05 : 21:43:08
I'm trying to merge two queries to produce one recordset for a loop. My problem is that I'm trying to pull unique shopping cart quantities for each product option along with data from other tables. If my shopping cart does not contain a quantity for a particular option, then the quantity must be zero. Otherwise, place the appropriate quantity from the shopping cart into the loop. The query below pulls the first quantity and places it in the loop for all product options, ughhh... I sure hope someone can help... I'm no SQL Guru!!! A (slightly) working sample can be found here. http://demo.wahmann.com/store/

SELECT products.productID, products.productName, products.productDesc, products.productImage, productOptions.optionSku, productOptions.optionDesc,
productOptions.optionPrice,
(SELECT cartQuantity
FROM shoppingCart
WHERE (productID = 1) AND (customerID = 2)) AS qty
FROM productOptions INNER JOIN
products ON productOptions.productID = products.productID LEFT OUTER JOIN
shoppingCart ON productOptions.optionSku = shoppingCart.cartSku
WHERE (products.productID = 1)

   

- Advertisement -