MySQL Query to Select All and Convert Date -


how write query in mysql select , convert 2 unix date columns readable, i.e. - from_unixtime(received_date) without needing manually write out each of other column names in select statement?

you can use

select *, from_unixtime(received_date), from_unixtime(other_date_field) table; 

you have 2 date columns shown in both time stamp , readable formats in result. might want use rename readable columns so:

select *, from_unixtime(received_date) date1, from_unixtime(other_date_field) date2 table; 

note wild card has come first:

select *, field from... 

you'll error if select field, * from...

i hope helps.


Comments

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World