I’m trying to select rows with field timestamp, which has a length shorter than 16 characters. I’ve tried the following:
SELECT LENGTH(timestamp), id
FROM my_table
HAVING LENGTH(timestamp) < 16
But I get this error:
#1054 – Unknown column ‘timestamp’ in ‘having clause’
Any suggestions?
I think you want:
Or if you’re actually trying to group the results…
Note the backticks (`) in each example to escape the column name.