001题求助

[复制链接]
查看11 | 回复2 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
you want to see order number, product number and quantity of any item in
which the product number and quantity match both the product number and

quantity of an item in order 605

which select statement you want to use
select ordid , prodid , qty from item

where ( prodid , qty) in

( select prodid , qty from item

where ordid = 605 )

and ordid 605;
b. select ordid , prodid , qty from item

where prodid , qty in

( select prodidfrom item

where ordid = 605 )

and ordid !=605;
c.
select ordid , prodid , qty from item

where ( prodid,qty)

( select prodid , qty from item

where ordid = 605 )

and ordid not in ( 605 );
d. select ordid , prodid , qty from item

where ( prodid , qty) =

( select prodid , qty from item

where ordid = 605 )

and ordid 605;
谁能 告诉我A D的不同吗?

回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
You used subquery in where clause, sowhen subquery returns multiple rows, where XXXX=subquery clause will return errors.
In D, if (select prodid, qty from item where ordid=605) returns more than one row, it show error message.
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
=比较,只能是 X=Y 的形式(X,Y为列或表达式)。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行