mysql 字段名为 timestamp ,不让转义
select ip_type 'IP类型', timestamp '数据填报时间' from ( select d.id, if(d.ip_type = 0, 'IP', 'IP段') ip_type , d.
timestamp, (CASE d.visible WHEN 0 THEN '否' WHEN 1 THEN '是' ELSE '' END)visible from aaa_tab d where timestamp <= '2022-04-30 23:59:59') t1 order by id desc
提示 SQL 错误 [1525] [HY000]: Incorrect DATETIME value: '数据填报时间'
修改为:t1.timestamp
,给 timestamp 加引号
select ip_type 'IP类型', t1.
timestamp '数据填报时间' from ( select d.id, if(d.ip_type = 0, 'IP', 'IP段') ip_type , d.
timestamp, (CASE d.visible WHEN 0 THEN '否' WHEN 1 THEN '是' ELSE '' END)visible from aaaa_tab d where timestamp <= '2022-04-30 23:59:59') t1 order by id desc