Mysql
 sql >> Datenbank >  >> RDS >> Mysql

MySQL Wählen Sie Wo maximales Datum und maximale Uhrzeit

Versuchen Sie es so

SELECT * FROM
(
  SELECT b.id, b.checkDate, b.checkTime, b.AccountId, b.costCenter, b.percentage, c.id, c.name     
  FROM Buckets b JOIN CustomerAccounts ca ON (b.accountId= ca.linkedAccountId)
                 JOIN Customer c ON (ca.customerId = c.id)
) AS S JOIN 
(
  SELECT max(checkDate) AS MaxDate,max(checkTime) As MaxTime FROM Buckets
) AS T ON T.MaxDate = S.checkDate AND S.checkTime = T.MaxTime