SQL 32
Mysql Short 2 By Guest on 27th April 2017 08:01:51 AM
  1. SELECT id,
  2.       ven,
  3.           CONCAT( ven, IF( RIGHT(ven,1) REGEXP ('^[0-9]'),'0', '' ) )  AS vif,
  4.       CONCAT( REPEAT( 0, 6 - LENGTH((SELECT vif))), (SELECT vif) ) AS ved
  5. FROM den ORDER BY ved ASC ;
  6.  
  7. CREATE TABLE `den` (
  8.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  9.   `ven` VARCHAR(45) DEFAULT NULL,
  10.   PRIMARY KEY (`id`),
  11.   UNIQUE KEY `ven_UNIQUE` (`id`)
  12. ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
  13.  
  14.  
  15. INSERT INTO `den` VALUES (1,'1a'),(2,'1b'),(3,'2a'),(4,'2b'),(5,'2c'),(6,'14a'),(7,'14c'),(8,'20');

Paste is for source code and general debugging text.

Login or Register to delete or keep track of your pastes.