Hi friends..
here is the query for Data kind of Recursive.
For Example….
for a particular thread in forum, its Comments
so in this case…
The Data structure will be like this
Table_3
Now if we want to have the hierarchical View of Data.
We can have query like this
now the Task is to Arrange the Data how you want to Display..
All the best
here is the query for Data kind of Recursive.
For Example….
for a particular thread in forum, its Comments
so in this case…
The Data structure will be like this
Table_3
Id | int |
ThreadText | nvarchar(MAX) |
PostedBy | int |
PostedOn | DateTime |
ParentId | int |
Now if we want to have the hierarchical View of Data.
We can have query like this
1: SELECT T2.id , T2.name ,T1.id as ParentId, T1.name as ParentName
2: FROM Table_3 AS T1 INNER JOIN
3: Table_3 AS T2 ON T1.id = T2.parentid
now the Task is to Arrange the Data how you want to Display..
All the best
No comments:
Post a Comment