2016-07-29 4 views
0

私はSQL Server 2005でこのコードを使用しています。SQL Server 2000 where code = select code from

select name 
from customers 
where code = (select code from inventory where Active = 1) 

SQL Server 2000でこれを行うにはどうすればよいですか?

+0

それはあなたが取得しているどのようなエラー –

+2

が動作するはず失敗しますか? –

+0

私は何が良いか、あなたのアプローチや内部結合を知りません: '顧客からのc.nameを選択するcインナー・インベントリi i.code = c.code where i.active = 1'。 –

答えて

1

..With =複数のコードがある場合で使用、クエリは、唯一のコードが返された場合

select name from customers where code in (select code from inventory where Active=1) 
+0

1つのコードしか返されない場合、sql-server 2000ではDoesnt '=(SELECT code ...)'が動作しますか? –

+0

はい、1つのコードが返される限り動作します – TheGameiswar

+0

@TimSchmelter、おそらくデータに依存する問題、使用するSQL Serverのバージョンとは関係ありません。 – jarlh

関連する問題