SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 having trouble jointing two tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cfm
Starting Member

6 Posts

Posted - 01/29/2013 :  17:23:53  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

4612 Posts

Posted - 01/29/2013 :  18:00:19  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000