AnsweredAssumed Answered

ExecuteSQL Where Query

Question asked by sccardais on Sep 20, 2015
Latest reply on Sep 21, 2015 by beverly

I want to return the number of unique values between two date ranges and for selected Departments.

 

Table = Paychecks

 

Each record in Paychecks includes a date, amount and the ID of the department the employee (fk_ID_Dept) works in as of the date of the check.


The query below works if I remove the red text if only 1 department is chosen. If more than one department is chosen, it doesn't work.

 

What is wrong with the query below? Additional info in attached screenshot to explain if necessary.

 

// Count Employees between 2 dates

 

ExecuteSQL (

"SELECT COUNT (DISTINCT p. fk_ID_Employee)

 

FROM Paychecks p

 

WHERE p. Pay_Date>= p. g_P1Start AND p. Pay_Date <= p. g_P1End AND p. fk_ID_Dept = p. gc_DeptsList"

; "" ; ""

)

Attachments

Outcomes