Skip to content

Instantly share code, notes, and snippets.

@Piethan
Created March 27, 2020 10:50
Show Gist options
  • Save Piethan/3e9a74641d1547d242b9d6a23036871c to your computer and use it in GitHub Desktop.
Save Piethan/3e9a74641d1547d242b9d6a23036871c to your computer and use it in GitHub Desktop.
SELECT date_format(t.change_time, "%Y-%m-%d") AS DATUM, date_format(t.change_time, "%H") AS STUNDE, q.name as QUEUE, tt.name AS STATUS, u.first_name, u.last_name, count(t.id) AS ANZAHL FROM ticket t
left join users u on
u.id = t.user_id
left join ticket_state tt on
tt.id=t.ticket_state_id
left join queue q on
q.id = t.queue_id
left join article a on
a.ticket_id = t.id
where t.change_time >= NOW() - INTERVAL 1 DAY
group by date_format(t.change_time, "%Y-%m-%d"), q.name, t.ticket_state_id, tt.name, u.first_name, u.last_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment