select article ,dealer,price
from shop
where article=0001
or dealer IN (select dealer from shop where article=0001);装换成exists??怎么结果不对,谁能帮弄下。
select article ,dealer,price
from shop
where
article=0001
or
exists (select dealer from shop where
shop.dealer=shop.dealer and
article=0001 );
from shop
where article=0001
or dealer IN (select dealer from shop where article=0001);装换成exists??怎么结果不对,谁能帮弄下。
select article ,dealer,price
from shop
where
article=0001
or
exists (select dealer from shop where
shop.dealer=shop.dealer and
article=0001 );
FROM shop
WHERE
article=0001
or
EXISTS(SELECT dealer FROM shop WHERE article=0001 );
select s.article,s.dealer,s.price from shop s where s.article=0001 or exists (select dealer from shop where dealer=s.dealer and article=0001 );这样应该就对了。你不该表的别名。那样这段话:
shop.dealer=shop.dealer
谁知道你的意图。语义混淆的。所以,使用别名,清晰安全。
from shop
where article=0001
or dealer IN (select dealer from shop where article=0001);
这sql语句有问题吧 第二个条件有用吗
from shop s
where
article=0001
or
exists (select 1 from shop where
dealer=s.dealer and
article=0001 );