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

mysql date viser resultater i dag/i går/uge

Denne mysql-kode burde virke for dig:

// Today
AND DATE(from_unixtime(comment_date)) = CURRENT_DATE

// Yesterday
AND DATE(from_unixtime(comment_date)) =  DATE_SUB(CURRENT_DATE,INTERVAL 1 DAY)

// This week
AND YEARWEEK(from_unixtime(comment_date), 1) =  YEARWEEK(CURRENT_DATE, 1)

// This month
AND YEAR(from_unixtime(comment_date)) = YEAR(CURRENT_DATE)
AND MONTH(from_unixtime(comment_date)) = MONTH(CURRENT_DATE)


  1. mysql, gentag gennem kolonnenavne

  2. Datatype for SUM-resultat i MySQL

  3. Brug MySQL Relational Databases på CentOS 5

  4. Hvorfor forbinder du ikke Android til databasen direkte?