sql >> Database teknologi >  >> RDS >> Mysql

MySQL Vælg Hvor maks. dato og maks. tid

Prøv sådan her

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


  1. Sequelize — brug UNIX-tidsstempel til DATE-felter

  2. Udvikling af PostgreSQL til Windows, del 2

  3. SQL cast datetime

  4. Sådan bruger du Rand-funktionen kombineret med Union i MySQL