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
2449
March 28, 2017 03:25AM
762
March 28, 2017 03:42AM
693
March 28, 2017 03:57AM
775
March 28, 2017 03:56AM
860
March 28, 2017 04:02AM
Re: Immatriculation véhicules
899
March 28, 2017 04:47AM
794
March 28, 2017 05:15AM
768
March 28, 2017 05:23AM
804
March 28, 2017 10:30AM
687
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.