开发者

Create a query for SQL Server into multiple tables and order the result in the form of the tree relationship

I have 3 tables:

1) id1, name
2) id2,name,id1
3) id3,name,i开发者_如何学God2

I'm looking for help to compose a query for SQL Server that will return a result ordered in form of an expanded tree - like:

t1.id1
 t2.id2
   t3.id3
   t3.id3
   t3.id3
 t2.id2
   t3.id3
   ...

All id fields are unique identifiers, so in result table I want to get just 2 fields - ID,Name


Standard SQL can not do that. You can't return a tree in that way - all rows are similar, meaning the column in each row comes from the same table.

You could however program something to do that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜