TheBugSlayer
Programmer
Hi guys,
I need to help a friend with a query and I must disclose that I have not have time to think about it myself since yesterday when he submitted it to me but I managed to create the table and put the data in it. So please only help if you have the time yourself...
The problem:
Given the table below:
TABLEA
Id Name IP Role Group
1 Server1 10.1 Primary 1
2 Server2 10.2 Backup 1
3 Server3 10.3 Primary 2
4 Server4 10.4 Backup 2
We need a query to produce the below resultset:
Query result:
PrimaryName PrimaryIP BackupName BackupIP Group
Server1 10.1 Server2 10.2 1
Server3 10.3 Server4 10.4 2
Thank you in advance, and once more, only help if you have the time. This is not course work or any school project.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA), Training HOTT cert SQL Server 2012 Business Intelligence (SSIS, SSAS).
I need to help a friend with a query and I must disclose that I have not have time to think about it myself since yesterday when he submitted it to me but I managed to create the table and put the data in it. So please only help if you have the time yourself...
Code:
CREATE TABLE [dbo].[SomeTable](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[IP] [nvarchar](50) NULL,
[Role] [nchar](10) NULL,
[Grp] [nchar](10) NULL
) ON [PRIMARY]
insert into SomeTable(Name, IP, Role, Grp) values('Server 1', '10.1', 'Primary', '1')
---
insert into SomeTable(Name, IP, Role, Grp) values('Server 2', '10.2', 'Secondary', '1')
---
insert into SomeTable(Name, IP, Role, Grp) values('Server 3', '10.3', 'Primary', '2')
---
insert into SomeTable(Name, IP, Role, Grp) values('Server 4', '10.4', 'Secondary', '2')
---
The problem:
Given the table below:
TABLEA
Id Name IP Role Group
1 Server1 10.1 Primary 1
2 Server2 10.2 Backup 1
3 Server3 10.3 Primary 2
4 Server4 10.4 Backup 2
We need a query to produce the below resultset:
Query result:
PrimaryName PrimaryIP BackupName BackupIP Group
Server1 10.1 Server2 10.2 1
Server3 10.3 Server4 10.4 2
Thank you in advance, and once more, only help if you have the time. This is not course work or any school project.
MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA), Training HOTT cert SQL Server 2012 Business Intelligence (SSIS, SSAS).