SQL QUERY NEEDED | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

SQL QUERY NEEDED

Hi all, I have 2 Tables Table1 and Table 2. Both Tables1 and Table2 may or may not contain the Data.
Let us assume that the table have fields T1F1 , T1K1, T1K2 ,T1K3
(T1K1, T1K2 ,T1K3 are key fields)
Let us assume that the table have fields T2F1 , T2K1, T2K2 ,T2K3
(T2K1, T2K2 ,T2K3 are key fields) I want the output as follows(A,b ,c,d are output fields)
A = T1k1 or T2K1
B = "some text" & T2K2
c = T1F1
D = T2F1
Where T1K2 = T2K2 and T1K3 = T2K3 I just want the output even one table as data.
I have tried the inner join,left and right join. All the above joins are not satisfying all the cases. Since i am matching the only 2 key fields, some times the records are duplicating.
I need the unique combined records. Please any one help me if you have any other methods.
I do not mind even if the method is store procedure. Regards
Shankar

Can you provide the information as described in this link?http://www.aspfaq.com/etiquette.asp?id=5006
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

Hi, Thank you for the reply.
I am ready to provide the detailed information.
Is it possible the paste the screen shotsin forum?

No
Post the table structures, some sample data and expected result. Thats enough
Madhivanan Failing to plan is Planning to fail
]]>