CREATE VIEW vwchatdata AS (
SELECT c.keyid,
c.conversationid,
c.conversationstart,
c.conversationstartltc,
c.userid,
u.name AS username,
u.department,
u.title,
c.chatinitiatedby,
c.agentchatcount,
c.agentchattotal,
c.agentchatmax,
c.agentchatmin,
c.agenthasread,
c.custchatcount,
c.custchattotal,
c.custchatmax,
c.custchatmin,
c.updated,
c.mediatype,
CASE
WHEN ((c.mediatype)::text = 'chat'::text) THEN 'Chat'::text
WHEN ((c.mediatype)::text = 'message'::text) THEN 'Message'::text
ELSE 'Unknown'::text
END AS mediatypedisplay
FROM (chatdata c
LEFT JOIN userdetails u ON (((c.userid)::text = (u.id)::text)))
)| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| keyid | varchar(50) | true | ||||
| conversationid | varchar(50) | true | ||||
| conversationstart | timestamp without time zone | true | ||||
| conversationstartltc | timestamp without time zone | true | ||||
| userid | varchar(50) | true | ||||
| username | varchar(200) | true | ||||
| department | varchar(200) | true | ||||
| title | varchar(200) | true | ||||
| chatinitiatedby | varchar(10) | true | ||||
| agentchatcount | integer | true | ||||
| agentchattotal | numeric(20,0) | true | ||||
| agentchatmax | numeric(20,0) | true | ||||
| agentchatmin | numeric(20,0) | true | ||||
| agenthasread | numeric(20,2) | true | ||||
| custchatcount | integer | true | ||||
| custchattotal | numeric(20,0) | true | ||||
| custchatmax | numeric(20,0) | true | ||||
| custchatmin | numeric(20,0) | true | ||||
| updated | timestamp without time zone | true | ||||
| mediatype | varchar(10) | true | ||||
| mediatypedisplay | text | true |
| Name | Columns | Comment | Type |
|---|---|---|---|
| public.chatdata | 17 | BASE TABLE | |
| public.userdetails | 13 | BASE TABLE |