如何从我的成员表中获取今天创建的所有记录

时间:2016-06-16 13:35:29

标签: sql-server

以下是我的尝试:

SELECT Email FROM members 
    WHERE RoleId = 5 ORDER BY CreatedAt DESC

SELECT Email FROM members 
    WHERE RoleId = 5 ORDER BY CreatedAt

SELECT 
    * 
FROM 
    members 
WHERE 
    CreatedAt = (SELECT MAX(2016-05-10 20:59:06.837) FROM members)
ORDER BY CreatedAt DESC;

1 个答案:

答案 0 :(得分:0)

如果你想要今天的所有新行....并且假设你总是填充CreatedAt列并假设它是一个日期时间你会使用这样的东西。

select * 
from members 
where CreatedAt > convert(date, getdate())