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.
Author |
Topic |
ssunny
Posting Yak Master
133 Posts |
Posted - 2008-11-19 : 12:27:02
|
Hey Guys,Need help. I have 2 tables test and test1 as below.test------------a int identity,b varchar(100),c varchar (100),d varchar (100)test1----------------e int identity,f varchar(100),g varchar(100)Now column f in test1 could be either b or c from test. I want to select everything from test and test1.Here's my queryselect t.*,t1.* from test tinner join test1 t1 on t.b = t1.finner join test1 t1 on t.c = t1.fbut it gives me an errorServer: Msg 1011, Level 15, State 1, Line 3The correlation name 't1' is specified multiple times in a FROM clause.Please advice.Thanks. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-19 : 12:36:04
|
[code]select t.*,t1.*,t2.* from test tinner join test1 t1 on t.b = t1.finner join test1 t2 on t.c = t2.f[/code] |
 |
|
ssunny
Posting Yak Master
133 Posts |
Posted - 2008-11-19 : 13:40:22
|
quote: Originally posted by visakh16
select t.*,t1.*,t2.* from test tinner join test1 t1 on t.b = t1.finner join test1 t2 on t.c = t2.f
I'm embarrassed.I dont know what I was thinking.Thanks Visakh. |
 |
|
|
|
|
|
|