Hello all,
I have a query regarding sql query.
DB 1
-----
Table A Table B
--------
ID Code HeaderID ID
-- --- -------- ---
1 100 1 1
2 200 1 2
3 100 2 3
DB 2
----
Table C
-------
ID Code Type
--------------------
1 100 1
2 101 1
3 100 2
set @HeaderID = 1
IF EXISTS (SELECT Code From Table A WHERE HeaderID=@ID AND Code not in (SELECT Code FROM Table C WHERE Type=1))
BEGIN
RAISERROR('code is not set.',16,1)
END
Table A and Table C are in different databases say DB1 and DB2.
How can we replace this with another query using join or something. Can we do it using one query by avoiding sub query.I want to get Code 200 which is not match with Table C Code.
Regards, Ranjith T Rajan Acty System India Pvt Ltd.