[Vtigercrm-developers] Order by Number

VTE support at vtigerexperts.com
Fri Nov 28 20:27:37 GMT 2014


Play around with this query, you will need to run multiple queries based on
the Ticket number length. It will add 0's to the number and the sorting will
work

### Select - Testing
SELECT 
  ticketid,
  ticket_no,
  LEFT(ticket_no, 2) AS TT,
  RIGHT(ticket_no, 3) AS num,
  CONCAT(LEFT(ticket_no, 2), '0', RIGHT(ticket_no, 3)) 
FROM
  `vtiger_troubletickets` 
WHERE LENGTH(ticket_no) < 6  AND LENGTH(ticket_no) >= 5

### Update

UPDATE
  `vtiger_troubletickets` 
  SET ticket_no=CONCAT(LEFT(ticket_no, 2), '0', RIGHT(ticket_no, 3)) 
WHERE LENGTH(ticket_no) < 6  AND LENGTH(ticket_no) >= 5




-----
VT Experts 
Email: Support at VTExperts.com 
Web:  http://www.VTExperts.com 
Skype: VTExperts 
Phone: +1 (818) 495-5557 



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Vtigercrm-developers-Order-by-Number-tp14609p14612.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.


More information about the vtigercrm-developers mailing list