Post

2 followers Follow
0
Avatar

CZQL filter by aggregated field value

Hi Clarizen Devs,

We just need to write an aggregated query which needs to filter the result set acc. to aggregated value. Let's say we need to select users timesheets.

For example, this query works fine.

SELECT 
SUM(C_DurationHours) as TotalTime, ReportedDate
FROM Timesheet
WHERE
ReportedBy = '{userid}'
GROUP BY ReportedDate

But we want to filter out users timesheets where TotalTime by ReportedDate value is less than a given value. (i.e 8 hours )
I tried the below queries but both of them return an error.
Is there a way of filtering select queries acc. to aggregated field values?

SELECT 
SUM(C_DurationHours) as TotalTime, ReportedDate
FROM Timesheet
WHERE
ReportedBy = '{userid}' 
AND SUM(C_DurationHours) < 8
GROUP BY ReportedDate
SELECT 
SUM(C_DurationHours) as TotalTime, ReportedDate
FROM Timesheet
WHERE
ReportedBy = '{userid}' 
AND TotalTime < 8
GROUP BY ReportedDate

Any help will be much appreciated. Thanks.

Mustafa Kipergil Answered

Official comment

Avatar

Hi Mustafa,

I've researched for this a bit and I found out it is not currently supported. You will have to filter it on the application level.

 

I hope this helps,

Elad

Elad Franklin
Comment actions Permalink

Please sign in to leave a comment.

1 comment