Need a Query

I have 2 tables (tblQuestions and tblAnswers)
Column in the tables:
tblQuestions: QuestionId,Question
tblAnswers: AnswerId,QuestionId,Answer

I want a query with the results in a signle column as below:
Q: Where is Brooklyn bridge
A:  Los Angeles
      Washhington DC
      New York

Thanks in advance.  

Who is Participating?
Instead of doing this in RadGrid. I suggest to keep your datasource (DataTable) which you bind with RadGrid in Session and when you want to move a row, move it in DataTable and then bind it with RadGrid.

I hope with this simple trick you will get what do you want.

As you choosed to use the Detail Grid in RadGrid so you don't need to get this data in one query.
Your main RadGrid will be bounded to Questions table and then on Child Grid bound, you will need to get QuestionID and filter answer based on it and display Answers in Child Grid.
Kindly correct if you are not working in Hierarchical RadGrid (Master-Detail RadGrid)?
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

select * from (
  select QuestionID, 0 as AnswerID, Question as Value
  from tblQuestion
  select QuestionID, AnswerID, Answer as Value
  from tblAnswer
) tbl
order by 1,2
cimscimsAuthor Commented:
malikirfan28: I have plans to use Master-Detail Radgrid but i don't want the gridlines. I tried using Gridlines="None", it is not working. I think you have the format i was looking at in my earlier post. Please share your thoughts.
You can remove the Grid Lines by customizing the CSS (style template). It will remove all Grid Lines.
Jagadishwor DulalBraces MediaCommented:
Why not use a join query which select all answer from tblAnswers Where questionid=tblquestions.questionid
cimscimsAuthor Commented:
malikirfan28: I have a problem if i use the hierarchy grid. I have move the Question and Answers row up and down in the radgrid. That's why i am looking to keep the Question and Answers in the same column.
I am sure you can set the same format as you gave screen shot in another thread using RadGrid.

However I could not understand you here as what do you mean by row up and down?

Kindly note that you should understand how RadGrid populates its Detail (Child) Grid.
cimscimsAuthor Commented:
When the user selects the row and clicks on a up/down button, i have to move the rows up/down in the radgrid. Please see the below link for information:
cimscimsAuthor Commented:
I have used the below link and i was able to

1) Move the rows up and down with the help of the below link

2) Format the grid as per the requirement. I wrote a Stored Procedure to get the Question and Answers to get into a single row.

I haven't tried your solution but my feeling is that would definetly work. Thank you for your time.

cimscimsAuthor Commented:
Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.