MySQL Forums
Forum List  »  French

Re: Error Code: 1271. Illegal mix of collations for operation 'concat'
Posted by: Oumar TOURE
Date: April 22, 2017 01:14AM

Merci celui ci marche très bien.

select CONCAT(prefixe,annee,mois,jours,LPAD(IF(t.lastDate <> t.dateCourante,0,t.numero + 1),4,'0')) as nouveau_code
from (SELECT
code,
convert(MID(code, 1, 1),char) AS prefixe,
convert(MID(code, 2, 4),char) AS lastAnnee,
convert(MID(code, 6, 2),char) AS lastMois,
convert(MID(code, 8, 2),char) AS lastJours,
convert(mid(CURRENT_TIMESTAMP, 1, 4),char) AS annee,
convert(MID(CURRENT_TIMESTAMP, 6, 2),char) AS mois,
convert(MID(CURRENT_TIMESTAMP, 9, 2),char) AS jours,
convert(MID(code, 10, 4),char) AS numero,
convert(CONCAT(MID(code, 2, 4),'-',MID(code, 6, 2),'-',MID(code, 8, 2)),char) as lastDate,
CURRENT_DATE as dateCourante
FROM demandeur
ORDER BY code DESC
LIMIT 1
) as t

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Error Code: 1271. Illegal mix of collations for operation 'concat'
1791
April 22, 2017 01:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.