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 的两行加入一行
id name 1 abc 1 def 2 a 2 b
我想要这样的结果
id name 1 abc def 2 a b
如果您只有两行,那么唯一棘手的部分是确保每行仅连接到不同的行,并且您不会将同一对行返回两次。
我会:
select a.name || chr(10) || b.name from table_a a join table_b b on (a.id = b.id and a.rowid < b.rowid)