diff --git a/services/describe/db/describe.go b/services/describe/db/describe.go index 14ac36be2..03eb41e05 100644 --- a/services/describe/db/describe.go +++ b/services/describe/db/describe.go @@ -246,6 +246,14 @@ UNION ALL (SELECT id, created_at, updated_at, 'compliance' AS job_type, 'all' AS integration_id, framework_id::text AS title, status, failure_message FROM compliance_jobs WHERE created_at >= ? AND created_at <= ?) ) ) AS t %s ORDER BY %s %s LIMIT ? OFFSET ?; +`, whereQuery, sortBy, sortOrder) + } else{ + rawQuery = fmt.Sprintf(` +SELECT * FROM ( +(SELECT id, created_at, updated_at, 'discovery' AS job_type, integration_id, resource_type AS title, status, failure_message FROM describe_integration_jobs) +UNION ALL +(SELECT id, created_at, updated_at, 'compliance' AS job_type, 'all' AS integration_id, framework_id::text AS title, status, failure_message FROM compliance_jobs) +) AS t %s ORDER BY %s %s LIMIT ? OFFSET ?; `, whereQuery, sortBy, sortOrder) }