开发者

mysql DATE_FORMAT using select *

开发者 https://www.devze.com 2023-02-24 01:02 出处:网络
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 ta开发者_如何学JAVAblename;

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 ta开发者_如何学JAVAblename;

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


I did not tested but you could try with this

SELECT t.*,DATE_FORMAT(updated,'%M %e, %Y %l:%i %p')
as updated from tablename as t;
0

精彩评论

暂无评论...
验证码 换一张
取 消