MySQL Forums
Forum List  »  Newbie

what is wrong with this subquery
Posted by: webmaster
Date: July 26, 2005 10:06AM

Thanks for helping.

I'm using MySQL 12.22 / distro 4.0.18

I'm trying to do a subquery to select a sum of information from another table based on ids in the selected row.

Here is my SQL.

//-----------------------------------

select id,title,deck,trucks,wheels,
(select sum(p.price)
from products as p
where p.id in (c.deck,c.trucks,c.wheels)) as total_price
from completes as c
order by total_price asc
limit 0,10

//-----------------------------------


thanks again for any help.

webg

Options: ReplyQuote


Subject
Written By
Posted
what is wrong with this subquery
July 26, 2005 10:06AM


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.