SQL - Extract Staff Details
v7,v6
See Create Export to CSV using SQL Query for information on using query below for export to csv.
Note: Access level names in export query need to be updated to match names in options -> Setup -> Staff -> Access tab,
select sm."Ref_Number", cm."First_Name", cm."Last_Name", sm."Id", sp."Title" as "Staff Position", sm."Access",
case when "Access" = 0 then 'Default'
when "Access" = 1 then 'Owner'
when "Access" = 2 then 'Desk'
when "Access" = 3 then 'AccessC' //update name of access level here
when "Access" = 4 then 'AccessD' //update name of access level here
when "Access" = 5 then 'AccessE' //update name of access level here
when "Access" = 6 then 'AccessF' //update name of access level here
when "Access" = 7 then 'AccessG' //update name of access level here
when "Access" is null then 'Default'
else "Access"
end as "Access Level"
from "Staff_Main" sm
join "Client_Main" cm on sm."Cln_Link" = cm."Ref_Number"
join "Staff_Position" sp on sm."Staff_Position" = sp."Ref_Number"
where sm."Status" = 'A'
and sm."Date_Finish" is NULL
and sm."Mob_DevId" is null