mysql DATE_FORMAT 使用 select *
一般来说,当我做出一个小的选择时,我会做这样的事情
SELECT id,DATE_FORMAT(updated,'%M %e, %Y %l:%i %p'),title from tablename;
,这会给我一个我喜欢的日期格式。
现在我有一个实例,我有一个选择,我不想指定每一列,因为我知道我想要它们全部。不过,我还需要按照上一个示例中的方式格式化日期。
有没有一种方法可以格式化例如更新的列和所有其他字段并仍然保持顺序?
我试过了,
SELECT *,DATE_FORMAT(updated,'%M %e, %Y %l:%i %p') as updated from tablename
但这似乎没有做任何事情
generally when i make a small select I would do something like this
SELECT id,DATE_FORMAT(updated,'%M %e, %Y %l:%i %p'),title from tablename;
and that would give me a date format that I like.
Now I have an instance where I have a select where I don't want to specify every column because I know I want them all. However I also need to format dates the way i did in the previous example.
is there a way to format say just the updated column and all other feilds and still keep there order ?
i tried this
SELECT *,DATE_FORMAT(updated,'%M %e, %Y %l:%i %p') as updated from tablename
but that doesn't seem to be doing anyhting
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有测试过,但你可以尝试一下
I did not tested but you could try with this