SELECT DISTINCT codeTypePrestation  FROM `p_prestationactes`
WHERE  codeTypePrestation='CSO'


SELECT   -- 83080
p.* 
FROM  `p_prestationactes` p INNER JOIN p_facture b ON (b.id=p.idFacture)
WHERE  b.codeGarantie=''


UPDATE p_prestationactes p 
INNER JOIN p_facture b ON (b.id=p.idFacture)
SET b.codeGarantie=p.codeGarantie
WHERE  b.codeGarantie='' AND p.codeGarantie!=''





UPDATE p_facture
SET codeGarantie='PHA'
WHERE codeGarantie=''
AND codeTypeFacture='PHAR'


SELECT DISTINCT codeGarantie FROM p_facture
WHERE  codeTypeFacture='LAB'
AND codeGarantie!=''