I stedet for at filtrere på et nøjagtigt bruger-id, bør du tjekke, om brugeren er relateret til problemet, sådan her:
select
t.title,
group_concat(
case when tu.type = 1 then
concat(u.firstname, ' ', u.lastname)
end) as creator,
t.priority,
t.date,
group_concat(
case when tu.type = 2 then
concat(u.firstname, ' ', u.lastname)
end SEPARATOR ' - ') as users
from
tickets t
inner join tickets_users tu on tu.ticketid = t.id
inner join users u on u.id = tu.userid
where
exists (
select
'x'
from
tickets_users tu2
where
tu2.ticketid = t.id and
tu2.userid = <youruserid> and
tu2.type = 1)
group by
t.id;
For