且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用SQL查询创建逗号分隔列表?

更新时间:2023-01-16 16:39:12

没有办法以DB不可知的方式做。
所以你需要得到整个数据集如下:

There is no way to do it in a DB-agnostic way. So you need to get the whole data-set like this:

select 
  r.name as ResName, 
  a.name as AppName
from 
  Resouces as r, 
  Applications as a, 
  ApplicationsResources as ar
where
  ar.app_id = a.id 
  and ar.resource_id = r.id

在按 ResName 分组时