CREATE TABLE [dbo].[tb_question]( [Id] [int] IDENTITY(1,1) NOT NULL, [Question] [varchar](500) NULL, [Status] [bit] NULL, [Complexity_Id] [int] NULL, CONSTRAINT [PK_tb_question] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[tb_question] WITH CHECK ADD CONSTRAINT [FK_tb_question_Que_Complexity] FOREIGN KEY([Complexity_Id]) REFERENCES [dbo].[Que_Complexity] ([Id]) GO ALTER TABLE [dbo].[tb_question] CHECK CONSTRAINT [FK_tb_question_Que_Complexity] GO
CREATE TABLE [dbo].[tb_option]( [Id] [int] IDENTITY(1,1) NOT NULL, [Qno] [int] NULL, [Opton] [varchar](200) NULL, [Correct_Ans] [bit] NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[tb_option] WITH CHECK ADD CONSTRAINT [FK_tb_option_tb_question] FOREIGN KEY([Qno]) REFERENCES [dbo].[tb_question] ([Id]) GO ALTER TABLE [dbo].[tb_option] CHECK CONSTRAINT [FK_tb_option_tb_question] GO
I have two tables one table store Questions and another table store Options for that question .. one question can have more than 4 Options
and I want output something like that
QuestionNo , Question , Option1,Option1ID , Option2 , Option2ID , Option3 , Option3ID , Option4 , Option4 ID and so on..
Thanks