I trying pull out a list of transaction that have codevalue = 98 and ddclang = S. I can not get a match because though values are on different lines in the a01c table.
SELECT * FROM dbo.T01_TransactionMaster t01 with (nolock), dbo.A01cAccountCodes a01c with (nolock) WHERE T01.AccountNumber = A01c.AccountNumber and a01c.CodeType = 'ACCTSTATUS' and a01c.CodeValue = '98' and a01c.CodeType = 'DDCLANG' and a01c.CodeValue = 'S'
A01c.accountCodes table
RecordId Account# CodeType CodeValue
39232281 38761371 ACCTSTATUS 98 30549600 38761371 BROKERLIST COVHO2 821632 38761371 DDCGENDER F 1961185 38761371 DDCLANG S 1096315 38761371 DDCSRCCODE 10SN42N304
You need to give us more information. First and foremost, you didn’t even ask a question. But, how do the tables relate? Why are you not using ansi style joins? Is that "result set" the result you are receiving or the one you want? Perhaps some sample data to illustrate the issue?