sql,创建一个迟到的返回日期查询

时间:2015-08-25 16:52:35

标签: sql

您好我正在试图弄清楚如何为租借电影的人列表创建查询,并将其返回3天或更长时间。我测试了下面的查询,似乎无法从我的表中提取所有数据,但只有一些数据。

Select * from USER U 
JOIN RENT R on U.userid = R.userid 
WHERE  R.ReturnDate - (SELECT CAST(GETDATE() AS DATE)) > 3

2 个答案:

答案 0 :(得分:1)

activate application "FaceTime"
tell application "System Events"
    tell process "FaceTime"
        click menu item "Webcam 520X" of menu 1 of menu bar item "Video" of menu bar 1
    end tell
end tell

答案 1 :(得分:0)

假设ReturnDate到期日,并且您正试图找出它是否是今天晚些时候的3天或更长时间....

SELECT * 
FROM USER AS u 
INNER JOIN RENT AS r USING (user_id)
WHERE r.ReturnDate <= CURDATE()-INTERVAL 3 DAY
;

...也假设MySQL