sql >> Databasteknik >  >> RDS >> Mysql

Mysql fråga, välj, gruppera och summera efter minuter

SELECT 
  SUM(donation_amount) AS total_donation_amount,
  EXTRACT(YEAR from time_inserted) AS year,
  EXTRACT(MONTH from time_inserted) AS month,
  EXTRACT(DAY from time_inserted) AS day,
  EXTRACT(HOUR from time_inserted) AS hour,
  EXTRACT(MINUTE from time_inserted) AS minute
FROM `DONATION`
WHERE `time_inserted` > '2012-12-07 10:00:00' 
AND `donation_type` = 'em1'
GROUP BY year, month, day, hour, minute;


  1. Haversine avståndsberäkning mellan två punkter i Laravel

  2. postgresql generera sekvens utan mellanrum

  3. Konvertera SQL datumformat? [dd.mm.åå till ÅÅÅÅ-MM-DD]

  4. Hierarkisk data - kapslad uppsättningsmodell:MySql