Finding the longest string with Mysql

  |   By  |  0 Comments

I recently wanted to find the length of the longest string from a column in a mysql table.

SELECT MAX(LENGTH(c1)) FROM t1 will give a different result to SELECT LENGTH(MAX(c1)) FROM t1 The first one gives the correct result!

Just wanted to save you some hours!

name

ABOUT THE AUTHOR - ANDY MOYLE

Andy Moyle is a church leader and web developer. His biggest project is the Church Admin WordPress plugin and app. He also runs, mainly so he can eat pizza.