Am queying table using this statement
[CODE=mysql]select max(SUBSTRING (policyno,11,6) ) as policyno from table where substring(polic yno,5,3) = 070[/CODE]
The statement works but it does not return the maximum value where policyno has leading zeros. Example of policyno is TM1/070/1/009899/2008
Want to remove 009899 substring and get the maximum value from the table then increment by one. It works only when the number has no leading zeros like 9899
Any help will be appreciated
[CODE=mysql]select max(SUBSTRING (policyno,11,6) ) as policyno from table where substring(polic yno,5,3) = 070[/CODE]
The statement works but it does not return the maximum value where policyno has leading zeros. Example of policyno is TM1/070/1/009899/2008
Want to remove 009899 substring and get the maximum value from the table then increment by one. It works only when the number has no leading zeros like 9899
Any help will be appreciated
Comment