查看: 1317|回复: 3
|
想要请教,怎样写这个statement
[复制链接]
|
|
我正在学习 SQL 碰到一些难题
http://sqlzoo.cn/a4m.htm
如何做啊尤其是
6. Assuming that any garment could be made in any of the available materials, list the garments (description, fabric, colour and pattern) which are expensive to make, that is, those for which the labour costs are 80% or more of the total cost.
[ 本帖最后由 玄劍 于 26-11-2006 12:58 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 24-11-2006 09:24 AM
|
显示全部楼层
或许先写出你认为是对的, 然后让大伙帮你纠正. |
|
|
|
|
|
|
|
楼主 |
发表于 27-11-2006 02:32 AM
|
显示全部楼层
我是想要这样做
select distinct description, fabric, colour ,pattern
from garment natural join material natural join quantities
where garment.STYLE_NO = material.MATERIAL_NO
and COST * 0.8 > ALL
(select LABOUR_COST , QUANTITY , COST
from garment , material , quantities
where end_date is null
and LABOUR_COST + QUANTITY * COST)
可是都不能-.-" |
|
|
|
|
|
|
|
发表于 27-11-2006 10:56 AM
|
显示全部楼层
有join,就要有on
SELECT * FROM tableA a JOIN (tableB b JOIN tableC c ON b.field=c.field) ON a.field=b.field |
|
|
|
|
|
|
| |
本周最热论坛帖子
|