Hi all.
I have this custom-type:
CREATE TYPE PERSONTYPE AS ( id BIGINT, firstname VARCHAR, lastname VARCHAR,
initialsVARCHAR );
I'm returning a column with this type using the following query, which lists
activities and its responsible-person (using the PERSONTYPE):
SELECT act.entity_id AS project_id, act.name AS project , (SELECT ROW
(p.entity_id, p.firstname, p.lastname, p.initials)::persontypeFROM
onp_crm_person pWHERE act.responsible = p.onp_user_id) AS responsible_person
fromonp_crm_activity act ORDER BY responsible_person ASC ;
But I need to ORDER BY different properties of PERSONTYPE, ie. initials, and
am wondering if there exists a mechanism to achieve the following:
SELECT act.entity_id AS project_id, act.name AS project , (SELECT ROW
(p.entity_id, p.firstname, p.lastname, p.initials)::persontypeFROM
onp_crm_person pWHERE act.responsible = p.onp_user_id) AS responsible_person
fromonp_crm_activity act ORDER BY responsible_person.initials ASC ;
How do I do that?
Thanks.
-- Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas(at)visena(dot)com <mailto:andreas(at)visena(dot)com>
www.visena.com <https://www.visena.com>
<https://www.visena.com>