Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的桌子
id name pid 101 Animal null 102 Dog 101 103 pug 102
我想要动物>狗>哈巴狗
我认为这样的东西适合你,因为我不知道你的 RDBMS 也许它需要一些改变
WITH NewAnimal AS (SELECT CAST((a.Desc + '>' + t.Name) AS VARCHAR(1000)) AS "Desc" FROM Table AS t JOIN NewAnimal AS a ON t.PID = a.id ) SELECT * FROM NewAnimal