MySQL Forums
Forum List  »  French

Re: Immatriculation véhicules
Posted by: Benoit St-Jean
Date: March 28, 2017 04:47AM

Cela devrait convenir (tenez-moi au courant!) :

SELECT CONCAT(prefixe, '-', LPAD(IF(numero=9999, 0, numero+1), 4, '0'), '-', IF(numero=9999, prochain_suffixe, suffixe)) AS nouvelle_plaque
FROM
(
SELECT plaque, MID(plaque, 1, 2) AS prefixe, (MID(plaque, 4, 4) + 0) AS numero, MID(plaque, 9, 2) AS suffixe, IF(MID(plaque, 10, 1)='Z', CONCAT(CHAR(ASCII(MID(plaque, 9, 1)) + 1), 'A'), CONCAT(MID(plaque, 9, 1), CHAR(ASCII(MID(plaque, 10, 1)) + 1))) AS prochain_suffixe
FROM plaques
ORDER BY suffixe DESC, numero DESC
LIMIT 1
) t

Options: ReplyQuote


Subject
Views
Written By
Posted
2941
March 28, 2017 03:25AM
969
March 28, 2017 03:42AM
919
March 28, 2017 03:57AM
1007
March 28, 2017 03:56AM
1090
March 28, 2017 04:02AM
Re: Immatriculation véhicules
1141
March 28, 2017 04:47AM
1019
March 28, 2017 05:15AM
983
March 28, 2017 05:23AM
1055
March 28, 2017 10:30AM
947
March 28, 2017 05:24AM


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.