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
 SQL Server Development (2000)
 joining a table to itself

Author  Topic 

lfmn
Posting Yak Master

141 Posts

Posted - 2001-03-19 : 20:46:29
I'm trying to join a table to itself to get the following output

COLUMN1 COLUMN2
item1 other5
item2 other6
item3 other7
item4 other8

I've tried the following:

select a.item as column1, b.item as column2
from syscolumns a, syscolumns b
where a.id = b.id
and a.id = 545654
and a.item like '%item%'
and b.item like '%other%'

I know I'm leaving something out, but can't remember what it is. I'm getting 16 rows returned instead of 4.

Any help would be appreciated.

lfmn
   

- Advertisement -