如何使我的查询工作?
我想从未列出今天日期的SQL中获取数据。
这是我的查询:
String sql = "select Room, Name, Age, EmailAddress, Phone, Nationality, CheckIn, CheckOut from customer where CURDATE() NOT IN (SELECT Room FROM customer WHERE CURDATE() between CheckIn and Checkout)";
最佳答案
为什么不只使用NOT BETWEEN
:
SELECT Room, Name, Age, EmailAddress, Phone, Nationality, CheckIn, CheckOut
FROM customer
WHERE CURDATE() NOT BETWEEN CheckIn AND Checkout
关于java - CURDATE()NOT IN(在CheckIn和CheckOut之间选择CURDATE()所在的房间),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40203448/