substring - MYSQL: multiple functions in query String -


the following query not working in mysql (a trigger)

set new.uniq = substr(md5(concat(new.lat, '-', new.lon)),0,5) 

only if delete substr give me correct output

set new.uniq = md5(concat(new.lat, '-', new.lon)) 

the problem zero:

set new.uniq = substr(md5(concat(new.lat, '-', new.lon)),0,5)                                                          ^ 

for example:

select substr('whatever', 0, 5) --> returns empty string select substr('whatever', 1, 5) --> returns 'whate' 

change 0 1 , should fine:

set new.uniq = substr(md5(concat(new.lat, '-', new.lon)),1,5) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -