i would like to know which of the following in table1 who has bought the code ABC. but i get this error:Invalid object name table1
SELECT * FROM openquery ( [testing] ,
' select A.ID,FirstName,LastName from (select * from table1)A inner join (select ID from table2 with (nolock) where code in (''ABC'') )B on A.ID = B.ID ')
select A.ID,FirstName,LastName
from table1 A
inner join
(select * from openquery
( [testing] ,'select ID
from table2 with (nolock)
where code in (''ABC'')')
)B
on A.ID = B.ID
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/