sql query without subquery

Posted by user1285737 on Stack Overflow See other posts from Stack Overflow or by user1285737
Published on 2012-03-22T23:22:51Z Indexed on 2012/03/22 23:29 UTC
Read the original article Hit count: 190

Filed under:
|
|

I need to rewrite this query and I'm not allowed to use a subquery. I need to select the name and color of the parts that are heavier than the wheel.

SELECT name, color
FROM parts
WHERE weight > (SELECT weight FROM parts WHERE name="wheel");

This is the table:

PARTS

ID    NAME    COLOR     WEIGHT    
1     wheel   black     100
2     tire    black     50
3     gear    red       20

Thanks in advance

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql