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
1461
March 28, 2017 03:25AM
364
March 28, 2017 03:42AM
318
March 28, 2017 03:57AM
351
March 28, 2017 03:56AM
426
March 28, 2017 04:02AM
Re: Immatriculation véhicules
437
March 28, 2017 04:47AM
389
March 28, 2017 05:15AM
354
March 28, 2017 05:23AM
371
March 28, 2017 10:30AM
320
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.