MySQL查询选择全部并转换日期
我如何在MySQL中编写一个查询,以选择全部并将2个UNIX日期列转换为可读的内容,即从unixtime(received_date)开始,而无需手动写出select语句中的每个其他列名?您可以使用MySQL查询选择全部并转换日期,mysql,date,timestamp,Mysql,Date,Timestamp,我如何在MySQL中编写一个查询,以选择全部并将2个UNIX日期列转换为可读的内容,即从unixtime(received_date)开始,而无需手动写出select语句中的每个其他列名?您可以使用 SELECT *, from_unixtime(received_date), from_unixtime(other_date_field) FROM table; 结果中将以时间戳和可读格式显示两个日期列。您可能希望使用AS重命名可读列,如下所示: SELECT *, from_unixtim
SELECT *, from_unixtime(received_date), from_unixtime(other_date_field) FROM table;
结果中将以时间戳和可读格式显示两个日期列。您可能希望使用AS重命名可读列,如下所示:
SELECT *, from_unixtime(received_date) AS date1, from_unixtime(other_date_field) AS date2 FROM table;
请注意,通配符必须放在第一位:
SELECT *, field FROM...
如果您选择字段,*FROM
我希望这有帮助