date action
---------- -------
2018-01-12 acquire
2018-01-14 release
2018-01-15 acquire
2018-01-19 release
我需要SELECT WHERE date> =' 2018-01-13'但只有一些人才能获得'行(按日期ASC排序),结果将是
2018-01-15 acquire
2018-01-19 release
(从满足日期条件后的第一次获得)。是否可以使用单个SQL语句?
答案 0 :(得分:1)
获取满足条件的最小日期,然后选择日期开始的所有行。
SELECT date, action
FROM yourTable
WHERE date >= (
SELECT MIN(date)
FROM yourTable
WHERE date >= '2018-01-13' AND action = 'acquire'
)
答案 1 :(得分:1)
//Just modifying the texture name to the right format
wstring tempName(fileName);
m_name = string(tempName.begin(), tempName.end());
//Modifying texture name (From original loaded textures names)
int pos = m_name.find_last_of("/");
if(pos >= 0)
{
m_name = m_name.substr(pos + 1, m_name.length());
}
m_name = m_name.substr(0, m_name.find_last_of("."));
//load the texture
result = CreateWICTextureFromFile(device, fileName, NULL, &m_texture, NULL);
答案 2 :(得分:1)
假设您正在尝试获取每个操作的第一个日期......
SELECT `date`, `action`
FROM theTable
WHERE (`date`, `action`) IN (
SELECT MIN(`date`), `action`
FROM theTable
WHERE `date` > '2018-01-13'
GROUP BY `action`
)