Base de Donnes
Base de Donnes
/************************************************/
/************************************************/
/************************************************/
/************************************************/
/************************************************/
*************************************************/
**************************************************
*************************************************
CREATE TABLE reclamation (
id int(11) NOT NULL AUTO_INCREMENT,
id_fonctionnel varchar(20) NOT NULL,
nom_client varchar(50) NOT NULL,
telephone varchar(20) NOT NULL,
email varchar(50) NOT NULL,
category varchar(20) NOT NULL,
status varchar(20) NOT NULL,
description text,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
agent_id int(11) NOT NULL,
departement_id int(11) NOT NULL,
service_id int (11) Not null
PRIMARY KEY (id),
FOREIGN KEY (agent_id) REFERENCES user(id),
FOREIGN KEY (departement_id) REFERENCES departement(id)
FOREIGN KEY (service_id) REFERENCES service(id)
);
/**********************************************
**************************************************
*************************************************
*************************************************
*************************************************
SELECT
i.id,
i.titre,
i.status,
i.created_at,
i.description,
i.createur_id,
i.reclamation_id,
i.departement_id,
GROUP_CONCAT(s.nom SEPARATOR ', ') AS service
FROM
intervention i
JOIN
intervention_services its ON i.id = its.intervention_id
JOIN
service s ON its.service_id = s.id
GROUP BY
i.id;