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
2906
March 28, 2017 03:25AM
959
March 28, 2017 03:42AM
910
March 28, 2017 03:57AM
1001
March 28, 2017 03:56AM
1080
March 28, 2017 04:02AM
Re: Immatriculation véhicules
1127
March 28, 2017 04:47AM
1013
March 28, 2017 05:15AM
972
March 28, 2017 05:23AM
1035
March 28, 2017 10:30AM
932
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.