Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Nested queries

Author  Topic 

Luke101
Starting Member

30 Posts

Posted - 2009-06-12 : 02:42:04
Hello, I am developing a question - answer site. What I am trying to do is, for every answer i would like to show several comments per answer. Similar to this url:

http://www.answerbag.com/q_view/1499220

as you can see for each answer their could be multiple comments in the answer and there are many answer to the question.

How would I make a query to show the answers then nest the comments in the answers. This has got my mind spinning.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-06-12 : 03:41:24
Maintain answer id along with Comment.

Then u can fetch easily!


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

Luke101
Starting Member

30 Posts

Posted - 2009-06-12 : 12:06:44
This is what I need.


Question:
Where can I find a good lawyer in Los Angeles?

Answer 1: Blah blah blah blah
Comment 1:Blah blah blah blah
Comment 2:Blah blah blah blah
Comment 3:Blah blah blah blah
Comment 4:Blah blah blah blah
Comment 5:Blah blah blah blah
Comment 6:Blah blah blah blah


Answer 2: Blah blah blah blah
Comment 1:Blah blah blah blah
Comment 2:Blah blah blah blah
Comment 3:Blah blah blah blah

Answer 3: Blah blah blah blah
Comment 1:Blah blah blah blah
Comment 2:Blah blah blah blah
Comment 3:Blah blah blah blah
Comment 4:Blah blah blah blah
Comment 5:Blah blah blah blah
Comment 6:Blah blah blah blah
Comment 7:Blah blah blah blah
Comment 8:Blah blah blah blah


Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-06-12 : 12:58:37
Are you trying to come up with a schema or a query or both?
Go to Top of Page

Luke101
Starting Member

30 Posts

Posted - 2009-06-12 : 13:35:44
i am trying to come up with a query. Thanks
Go to Top of Page
   

- Advertisement -