Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Need a Query

Posted on 2011-04-25
12
Medium Priority
?
285 Views
Last Modified: 2012-05-11
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
      Chicago

Thanks in advance.  

0
Comment
Question by:cimscims
12 Comments
 
LVL 4

Expert Comment

by:malikirfan28
ID: 35460859
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.
0
 
LVL 4

Expert Comment

by:malikirfan28
ID: 35460861
Kindly correct if you are not working in Hierarchical RadGrid (Master-Detail RadGrid)?
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 35460868
select * from (
  select QuestionID, 0 as AnswerID, Question as Value
  from tblQuestion
  union
  select QuestionID, AnswerID, Answer as Value
  from tblAnswer
) tbl
order by 1,2
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 

Author Comment

by:cimscims
ID: 35460899
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.
0
 
LVL 4

Expert Comment

by:malikirfan28
ID: 35460909
You can remove the Grid Lines by customizing the CSS (style template). It will remove all Grid Lines.
0
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 35464732
Why not use a join query which select all answer from tblAnswers Where questionid=tblquestions.questionid
0
 

Author Comment

by:cimscims
ID: 35467517
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.
0
 
LVL 4

Expert Comment

by:malikirfan28
ID: 35467604
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.

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/hierarchyloadmodemixed/defaultcs.aspx
0
 

Author Comment

by:cimscims
ID: 35467661
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:
http://www.telerik.com/community/forums/aspnet/grid/move-grid-rows-up-and-down.aspx
0
 
LVL 4

Accepted Solution

by:
malikirfan28 earned 2000 total points
ID: 35469192
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.

0
 

Author Comment

by:cimscims
ID: 35471144
malikirfan28:
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
http://www.telerik.com/community/code-library/aspnet-ajax/grid/move-rows-up-down-using-radgrid-for-asp-net-ajax-prometheus.aspx

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.


Move-Rows-up-and-down.png
0
 

Author Closing Comment

by:cimscims
ID: 35471153
Thank you.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question