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 2008 Forums
 Transact-SQL (2008)
 having trouble jointing two tables

Author  Topic 

cfm
Starting Member

6 Posts

Posted - 2013-01-29 : 17:23:53
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

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-01-29 : 18:00:19
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?

Here are some links that can help guide you on to ask your question in a way that we can help you better:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Go to Top of Page
   

- Advertisement -