Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Return others result

Author  Topic 

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2009-05-18 : 03:28:58
I've below table,

tblTrnxInfo
TrnxID | BankID | AccNo | TrnxAmt
-----------------------------------------
1 | KLM01 | 1898998 | 249.00
3 | JUI23 | 1898998 | 244.00
6 | KLM01 | 1988745 | 224.00
9 | KLM01 | 1898998 | 256.00

tblMyBank
BankID | AccNo
------------------------------------------
KLM01 | 1898998

I can query as

select t1.TrnxID,t1.BankID,t1.AccNo,t1.TrnxAmt
from tblTrnxInfo t1 inner join tblMyBank t2
on t1.BankID=t2.BankID and t1.AccNo=t2.AccNo

TrnxID | BankID | AccNo | TrnxAmt
-----------------------------------------
1 | KLM01 | 1898998 | 249.00
9 | KLM01 | 1898998 | 256.00

how to adjust my query and it will return others result,
TrnxID | BankID | AccNo | TrnxAmt
-----------------------------------------
3 | JUI23 | 1898998 | 244.00
6 | KLM01 | 1988745 | 224.00

Please help

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-05-18 : 04:28:52
select t1.TrnxID,t1.BankID,t1.AccNo,t1.TrnxAmt
from tblTrnxInfo t1 left join tblMyBank t2
on t1.BankID=t2.BankID and t1.AccNo=t2.AccNo
where t2.bankid is null
Go to Top of Page
   

- Advertisement -