1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| EXPLAIN SELECT DISTINCT
a.idClaim as sin,
a.clientName as nomclient,
a.clientCode as codeclient,
a.nContract as cont,
a.brand as marque,
a.model as modele,
a.comLastname as comm,
a.comName as com,
a.persistence as persis,
b.dateprevue as dateprevue,
b.typeaction as typeaction,
b.actionid as actionid,
c.nom_user as nom,
c.prenom_user as prenom,
CASE
WHEN d.codeMemberClient IS NOT NULL THEN e.color_noteClient
ELSE 'FFFFFF'
END as color
FROM memberClient as d right join claim as a on a.clientCode = d.codeMemberClient
left join noteClient as e on d.noteMemberClient = e.id_noteClient,
action as b,
user as c
WHERE a.idClaim=b.nsinistrea
AND b.dateprevue =
(SELECT b.dateprevue
FROM action as b
WHERE b.nsinistrea = a.idClaim ORDER BY actionid DESC LIMIT 1)
AND b.utilisateur=c.id_user
AND (a.state = '-1' OR a.persistence = '1')
AND b.utilisateur IN ('2','12','13','14','15','16','17','18','19','20','21','22','23','27')
GROUP BY b.nsinistrea ORDER BY b.dateprevue ASC, b.actionid DESC |
Partager