简体   繁体   中英

How to get values from phpmyadmin with the same datetime?

I am building a mini-portal/website and I need to select values with the same DateTime. 在此处输入图像描述

For example, the first three values have the same DateTime and I would like to select them, yet I don't know how the SQL code should look like.

This selects those records which has the same date attribute and orders them by the date attribute.

SELECT
    T2.*
FROM
    (
    SELECT 
       date
    FROM
       TABLENAME
    GROUP BY
       date
    HAVING
       COUNT(date) >= 2
    ) T1
    JOIN
    TABLENAME T2 ON T1.date = T2.date
ORDER BY date

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM