我想要连接的表的表模式是:-
uuid uuid NOT NULL DEFAULT gen_random_uuid(),
actor_uuid uuid NOT NULL,
ref_uuid uuid NOT NULL,
ref_type character varying(255) COLLATE pg_catalog."default" NOT NULL,
created_at timestamp with time zone NOT NULL,
activity jsonb NOT NULL,
CONSTRAINT activity_log_pkey PRIMARY KEY (uuid)
在活动列中,数据将类似于:-
[{"type": "USER",
"uuid": "6ae0fa04-804d-492a-94fa-ccf75556379f"},
{"type": "MESSAGE",
"message": "activity_template.collection_details.updated"},
{"type": "COLLECTION", "uuid": "914f4c89-1857-4fbe-aa3e-436e343b42f2"}]
我想在一个特定的对象中连接我的用户表,其中类型为USER,并且对于COLLECTION也是如此
请告诉我如何加入表并在某个地方得到响应,如
[
{
activity: [
{
type: "USER",
uuid: "6ae0fa04-804d-492a-94fa-ccf75556379f",
first_name: "Henil",
last_name: "Mehta"
},
{
type: "MESSAGE",
name: "Netflix"
},
{
type: "COLLECTION",
uuid: "7qe0fa04-804d-492a-94fa-ccf75556379f",
title: "Netflix"
},
]
}
]
1条答案
按热度按时间zzlelutf1#
DBFiddle demo