platform icon indicating copy to clipboard operation
platform copied to clipboard

Order by $lookup is not working

Open haiodo opened this issue 1 year ago • 1 comments

SELECT 
    documents.*, 
    lookup_documents_project.\"_id\" as \"lookup_documents_project__id\", 
    lookup_documents_project.\"_class\" as \"lookup_documents_project__class\", 
    lookup_documents_project.\"createdBy\" as \"lookup_documents_project_createdBy\", 
    lookup_documents_project.\"modifiedBy\" as \"lookup_documents_project_modifiedBy\", 
    lookup_documents_project.\"modifiedOn\" as \"lookup_documents_project_modifiedOn\", 
    lookup_documents_project.\"createdOn\" as \"lookup_documents_project_createdOn\", 
    lookup_documents_project.\"space\" as \"lookup_documents_project_space\", 
    lookup_documents_project.\"attachedTo\" as \"lookup_documents_project_attachedTo\", 
    lookup_documents_project.\"%hash%\" as \"lookup_documents_project_%hash%\", 
    lookup_documents_project.\"data\" as \"lookup_documents_project_data\" 
    FROM documents 
        INNER 
            JOIN space AS sec 
                ON sec._id = documents.space 
                AND sec.\"workspaceId\" = $1::uuid 
                AND (sec.members @> '{\"6789634db7b5ed22e57b9d3f\"}' 
                OR sec.\"_class\" = 'core:class:SystemSpace') 
                LEFT JOIN documents AS lookup_documents_project ON documents.data#>>'{project}' = lookup_documents_project.\"_id\" 
                AND lookup_documents_project.\"workspaceId\" = '0032cbc0-b6f1-4085-8a7d-18efc3f3114b' 
                WHERE documents.\"workspaceId\" = $1::uuid 
                AND documents.data#>>'{document}' = $2::text 
                AND documents.\"_class\" = $3::text 
                ORDER BY lookup_documents_project.$lookup.project.createdOn DESC LIMIT 1

haiodo avatar Jan 18 '25 17:01 haiodo

Connected to Huly®: UBERF-9172

huly-github-staging avatar Jan 18 '25 17:01 huly-github-staging