MySQL Invalid type for column time/time_sec, must be of type timestamp or unix timestamp, got: <nil> <nil>

I’m just trying a time series with MySQL.
I’ve used a suggestion in the forum, but on some table it works on others doesn’t:

SELECT  time_sec AS "time", count(*)
FROM (select  from_unixtime(unix_timestamp(insertdate)) as time_sec from TABLE_NOT_GOOD) as tmp
WHERE $__timeFilter(time_sec)
ORDER  BY time_sec

The column definition is

`insertdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

The strange things is that on other tables with same column, it works.

Also I don’t understand why just using the insertdate in the query doesn’t work.

1 Like