Please use the below query to get the report on Asset Ownership History.
SELECT r.resourcename AS "Workstation Name",
ct.componenttypename AS "Product type",
rs.displaystate AS "Asset State",
aa.first_name AS "Assigned User",
LONGTODATE(sh.starttime) AS "Changed Date",
usr.first_name AS "Changed By"
FROM resources r
LEFT JOIN resources res ON res.RESOURCEID = r.RESOURCEID
LEFT JOIN componentdefinition cd ON r.componentid = cd.componentid
LEFT JOIN componenttype ct ON cd.componenttypeid = ct.componenttypeid
LEFT JOIN resourcestatehistory sh ON r.resourceid = sh.resourceid
LEFT JOIN resourceownerhistory his ON sh.statehistoryid = his.statehistoryid
LEFT JOIN resourcestate rs ON sh.resourcestateid = rs.resourcestateid
LEFT JOIN aaauser aa ON his.userid = aa.user_id
LEFT JOIN aaauser usr ON sh.userid = usr.user_id
WHERE sh.prevresourcestateid IS NOT NULL and extract(epoch from(now()::TIMESTAMP - to_timestamp(sh.starttime/1000)::TIMESTAMP))/3600/24 < 90 ORDER BY 1,5 desc;