MySQL Forums
Forum List  »  Newbie

trouble with join and nested query
Posted by: abhiram p
Date: September 11, 2007 10:59AM

table temp has 2 fields login and cartId
table cart has cartId, quantity,size
table price_list has size,price

i want to get sum(quantity) for every size for a particular cartId.
since cart contains items of same size,size is redundant in cart.
and.. i dont know the cartId but i know the login whose cartid is needed.

i wrote the following query which did not work.

SELECT p.size,sum(c.quantity)
FROM price_list p, cart c
WHERE c.size=p.size AND c.cartId=(
SELECT t.cartId
FROM temp t
WHERE login='abhi_p24@yahoo.com')
GROUP BY c.size;

please help me out.

Options: ReplyQuote


Subject
Written By
Posted
trouble with join and nested query
September 11, 2007 10:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.