简体   繁体   中英

MySQL MIN() + 1 row

I am running a SELECT query to get data from MySQL

SELECT
    MIN(datetime) as created,
    MAX(datetime) as updated,
    COUNT(CASE WHEN type = 'update' AND contact_name <> 'System' THEN 1 END) as replies,
    COUNT(CASE WHEN type = 'update' AND (contact_name * 1 = contact_name) THEN 1 END) as customer_replies

You haven't given all the details needed but I think that you want

SELECT
    MIN(datetime) as created_second_minimum 
FROM TableName
WHERE 
   datetime > (SELECT
                         MIN(datetime)
                          FROM TableName);

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