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
 Transact-SQL (2000)
 Tough Time in SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-01 : 08:36:49
Satish writes "I m having 2 tables called A,B with cols as

A ---> a1, a2(uniqueidentifier), a3(uniqueidentifier)
B ---> b1(uniqueidentifier), b2, b3

now the value present in a2 and a3 is the one which is also there in b1.
so now i want a1,a2.b2,a2.b3, a3.b2, a3.b3 in single statement, this is a small part of the joins which i had to made..
if anyone knows answer or want more details plz contact at

panwar_satish@rediffmail.com

Try it out if you can and help me out...."

vivek.kumargupta
Starting Member

45 Posts

Posted - 2005-06-01 : 08:47:06
Can you plz clarify ur question with an example

Thanks,
Vivek
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-06-01 : 14:34:14
You need to join table B twice. Something like

SELECT t1.a1, t2.b2, t2.b3, t3.b2, t3.b3
FROM A as t1
JOIN B as t2 on t1.a2 = t2.b1
JOIN B as t3 on t1.a3 = t3.b1


---------------------------
EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -