表格xy包含以下字段:
id |日期|值
我想提取特定ID的最小值和从第12行开始的相应日期:
代码SELECT MIN(value) FROM (SELECT value FROM tablexy where id=1 LIMIT 11, 1000) as x
这会返回最低值,但是,我需要添加什么才能获得最低值的相关日期?
答案 0 :(得分:2)
SELECT value,`date` FROM (SELECT value,`date` FROM tablexy
where id=1 LIMIT 11, 1000) as x order by value limit 1;
答案 1 :(得分:0)
SELECT field from tablexy where value = (select MIN(value) FROM (SELECT value FROM tablexy where id=1 LIMIT 11, 1000))