MySQL Forums
Forum List  »  General

Re: min/max function result datatype
Posted by: Peter Brawley
Date: May 08, 2019 02:13PM

Can't reproduce your result. MySQL often decides data type from context ...

drop table if exists t, tmpt;
create table t( d date, t timestamp, v varchar(20) );
insert into t values( curdate(), now(), now() );
select * from t;
create temporary table tmpt
select min(timestamp(d)) as d ,min(timestamp(t)) as t,min(timestamp(v)) as v from t;
show create table tmpt;

... gets us ...

CREATE TEMPORARY TABLE tmpt (
d datetime DEFAULT NULL,
t datetime DEFAULT NULL,
v datetime(6) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

Options: ReplyQuote


Subject
Written By
Posted
Re: min/max function result datatype
May 08, 2019 02:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.