
-- Afficher les client à banir des Service client et satisfaction
SELECT * FROM `customer` WHERE score > 2 AND param5 = 'tartempion'

-- Marquer les customer Tartempion
UPDATE customer SET `param5` = 'tartempion' WHERE score > 2 AND param5 IS NULL

-- Mise à jour des tarif wifi
UPDATE wifi SET `montant` = 250 WHERE `created_at` = `updated_at` AND montant = 200

UPDATE wifi SET `montant` = '8500' WHERE  montant IN (SELECT montant FROM `wifi` WHERE `created_at`=`updated_at` AND `montant` = 10500)

-- Récupération des clients wifi à recontacter entre le '2020-06-24 00:00:01' AND '2020-06-27 00:00:01' 
SELECT c.phoneclient, h.operation, h.montant, h.content FROM historiquetrans h, customer c WHERE h.operation = 'achat_wifi' AND h.phonevendeur = c.phoneclient and h.created_at BETWEEN '2020-06-24 00:00:01' AND '2020-06-27 00:00:01' 

-- Compter le nompre d'appel d'un agent service client
SELECT COUNT(`phoneclient`) FROM customer WHERE `param5` LIKE '%14' 

-- Obtenir comptes client non satisfait
SELECT c.phoneclient, c.solde , c.score FROM customer c WHERE c.solde > 100 AND c.phoneclient IN ( SELECT h.phonevendeur FROM historiquetrans h WHERE h.operation LIKE '%recharge%' ) LIMIT 2000

-- Obternir le nombre de transactions d'une fille 
SELECT * FROM `historiquetrans` WHERE param1 IS NULL and operation = 'achat_credit' AND etat != "locked" AND etat !="atraiter" AND `phonevendeur` IN ( SELECT phoneclient FROM customer WHERE param5 LIKE '%Service_client_appel_by_id-->14%') ORDER BY `historiquetrans`.`etat` DESC
