Re: min/max function result datatype
I have table orders with field OrderDate, the datatype is DateTime
select min(`orders`.`orderdate`) FROM `orders` AS `orders` - return date with Datetime datatype
select min(TIMESTAMP(MAKEDATE(year(`orders`.`orderdate`),1))) FROM `orders` AS `orders` - resturn string datatype.
select TIMESTAMP(MAKEDATE(year(`orders`.`orderdate`),1)) FROM `orders` AS `orders` - resturn datetime datatype.
DDL:
CREATE TABLE `orders` (
`OrderID` int(11) DEFAULT NULL,
`CustomerID` varchar(5) DEFAULT NULL,
`EmployeeID` int(11) DEFAULT NULL,
`OrderDate` datetime DEFAULT NULL,
`RequiredDate` datetime DEFAULT NULL,
`ShippedDate` datetime DEFAULT NULL,
`ShipVia` int(11) DEFAULT NULL,
`Freight` float DEFAULT NULL,
`ShipName` varchar(40) DEFAULT NULL,
`ShipAddress` varchar(60) DEFAULT NULL,
`ShipCity` varchar(15) DEFAULT NULL,
`ShipRegion` varchar(15) DEFAULT NULL,
`ShipPostalCode` varchar(10) DEFAULT NULL,
`ShipCountry` varchar(45) DEFAULT NULL,
`Invoiced` bit(1) DEFAULT NULL,
`AdHocUserName` varchar(15) DEFAULT NULL)