MySQL Forums
Forum List  »  Newbie

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

ok,
in price_list table,

size price
4x6 0.15
5x8 0.57
6x12 3.50
-----------------
in temp table,

cartId login
1 abc
2 qwe
3 dfg
---------------
in cart table

cartId photoId size quantity
1 sj.jpg 4x6 5
1 dg.jpd 4x6 1
1 dg.jpg 5x8 2
1 dsj.jpg 6x12 1
1 hd.jpg 5x8 3
2 wer.jpg 6x12 10
3 gkh.jpg 5x8 5
4 shd.jpg 4x6 6
------------------------------------

now in the above data, i want the sum of quantities for all existing sizes of cartid=1. that means..
i want the output as
sum(quantity) size
--------------------
4x6 6
5x8 5
6x12 1

i dont have the cartid, but i have the login of cartid=1.
with the login, i want the output shown above.
i think i made myself fairly clear now.

Options: ReplyQuote


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


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.