You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT JSON_ARRAYAGG(
JSON_OBJECT(
'weight', weight,
'tax_number', tax_number
)
) AS result
FROM (
SELECTu.alias,
uptn.valueAS tax_number,
SUM(TIMESTAMPDIFF(SECOND, t.start_time, t.end_time) /3600) /8AS total_work_days,
CASE
WHEN SUM(TIMESTAMPDIFF(SECOND, t.start_time, t.end_time) /3600) /8>=260*2 THEN 5-- 2 anos
WHEN SUM(TIMESTAMPDIFF(SECOND, t.start_time, t.end_time) /3600) /8>=260 THEN 4-- 1 ano
WHEN SUM(TIMESTAMPDIFF(SECOND, t.start_time, t.end_time) /3600) /8>=100 THEN 3
WHEN SUM(TIMESTAMPDIFF(SECOND, t.start_time, t.end_time) /3600) /8>=50 THEN 2
ELSE 1
END AS weight
FROM kimai2_timesheet t
JOIN kimai2_projects p ONp.id=t.project_idJOIN kimai2_customers c ONc.id=p.customer_idJOIN kimai2_users u ONu.id=t.userJOIN kimai2_user_preferences uptn ONuptn.user_id=u.idANDuptn.name='tax_number'WHEREc.id NOT IN (18, 22)
ANDt.userIN (SELECTt.userFROM kimai2_timesheet t WHEREt.end_time>='2024-08-01 23:59:59'ANDt.end_time<= NOW())
GROUP BYu.alias, uptn.valueORDER BY weight, uptn.value
) AS aggregated_data;
Retorno necessário por cooperado:
A query deve considerar:
The text was updated successfully, but these errors were encountered: