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 2005 Forums
 Transact-SQL (2005)
 query

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-23 : 08:16:36
i have this table:
ID      Name
1 COM
1 ROM


i want to get:
ID  Name  ID   Name
1 COM 1 ROM

how can i dot it?

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-23 : 08:27:30
[code]
select a.ID, a.Name, b.ID, b.Name
from table a
inner join table b on a.ID = b.ID
and a.Name <> b.Name
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-23 : 08:33:09
quote:
Originally posted by khtan


select a.ID, a.Name, b.ID, b.Name
from table a
inner join table b on a.ID = b.ID
and a.Name <> b.Name



KH
[spoiler]Time is always against us[/spoiler]


the problem is give me this result:
ID      Name            ID      Name
1 COM 1 ROM
1 ROM 1 COM


Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-23 : 09:25:25
the data is always in PAIR ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-07-23 : 10:01:34
no,
this is very strange question ,someone ask me but i do not answere to him
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-23 : 10:05:48
quote:
Originally posted by inbs

no,
this is very strange question ,someone ask me but i do not answere to him



So can you post more sample data and the expected result ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -