postgresql json aggregate

前端 未结 2 1211
生来不讨喜
生来不讨喜 2021-02-14 10:10

I\'m using postgres 9.4, I have the following query:

SELECT pid, code, name FROM activity, (
  SELECT code FROM project
) projects WHERE activity.pcode = project         


        
2条回答
  •  佛祖请我去吃肉
    2021-02-14 10:59

    SELECT pid from activity a, (
        select json_agg(project) from project where code = a.code 
    ) as p
    

    Something like that ...

提交回复
热议问题