How to Join This Query For My Requirement.

Posted by Jayakumars under Sql Server on 10/17/2012 | Points: 10 | Views : 853 | Status : [Member] [MVP] | Replies : 1
hi

How to Join (Column and Data) This Query For My Requirement.

Execute This Query
=======================

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TableQ1000](
[Id] [int] IDENTITY(1,1) NOT NULL,
[QText] [nvarchar](max) NULL,
[QCode] [nvarchar](50) NULL,
[Code] [int] NULL
) ON [PRIMARY]
GO

SET IDENTITY_INSERT [dbo].[TableQ1000] ON
INSERT [dbo].[TableQ1000] ([Id], [QText], [QCode], [Code])VALUES (1, N'India is Big Country?', N'Q1',6)
INSERT [dbo].[TableQ1000] ([Id], [QText], [QCode], [Code])VALUES (2, N'India is Peaceful Country?', N'Q2',4)
INSERT [dbo].[TableQ1000] ([Id], [QText], [QCode], [Code])VALUES (3, N'India is PowerFul Country?', N'Q3',3)
INSERT [dbo].[TableQ1000] ([Id], [QText], [QCode], [Code])VALUES (4, N'India is Welathy Country?', N'Q4',1)
INSERT [dbo].[TableQ1000] ([Id], [QText], [QCode], [Code])VALUES (5, N'India is strong Country?', N'Q5',2)
SET IDENTITY_INSERT [dbo].[TableQ1000] OFF


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].TableA1000(
[AId] [bigint] IDENTITY(1,1) NOT NULL,
[Q1] [nvarchar](50) NULL,
[Q2] [nvarchar](50) NULL,
[Q3] [nvarchar](50) NULL,
[Q4] [nvarchar](50) NULL,
[Q5] [nvarchar](50) NULL,
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].TableA1000 ON
INSERT [dbo].TableA1000 ([AId],[Q1], [Q2], [Q3], [Q4], [Q5]) VALUES (1, N'65', N'1', N'2', N'0', N'2')
INSERT [dbo].TableA1000 ([AId],[Q1], [Q2], [Q3], [Q4], [Q5]) VALUES (2, N'1', N'2', N'2', N'0', N'1')
INSERT [dbo].TableA1000 ([AId],[Q1], [Q2], [Q3], [Q4], [Q5]) VALUES (3, N'2', N'1', N'1', N'1', N'2')
INSERT [dbo].TableA1000 ([AId],[Q1], [Q2], [Q3], [Q4], [Q5]) VALUES (4, N'1', N'1', N'2', N'0', N'1')
INSERT [dbo].TableA1000 ([AId],[Q1], [Q2], [Q3], [Q4], [Q5]) VALUES (5, N'2', N'2', N'0', N'0', N'2')
INSERT [dbo].TableA1000 ([AId],[Q1], [Q2], [Q3], [Q4], [Q5]) VALUES (6, N'2', N'0', N'1', N'1', N'1')
SET IDENTITY_INSERT [dbo].[TableQ1000] OFF


This Query Output like this see below image
=========================================

Mark as Answer if its helpful to you


Responses

Posted by: Jayakumars on: 10/17/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down

i need this output this see below image.

 Download source file

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response