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
1432
March 28, 2017 03:25AM
345
March 28, 2017 03:42AM
301
March 28, 2017 03:57AM
337
March 28, 2017 03:56AM
410
March 28, 2017 04:02AM
Re: Immatriculation véhicules
424
March 28, 2017 04:47AM
376
March 28, 2017 05:15AM
340
March 28, 2017 05:23AM
354
March 28, 2017 10:30AM
309
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.