John Henrix Navarro Gloria John Henrix Navarro Gloria - 1 month ago 11
MySQL Question

CURDATE() NOT IN (select room where CURDATE() between CheckIn and CheckOut)

how can i make my query works.
i want to get the data from my sql where the date today is not listed.

heres my query

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)";


Data Structure
my jtable

Answer

Why not just use NOT BETWEEN:

SELECT Room, Name, Age, EmailAddress, Phone, Nationality, CheckIn, CheckOut
FROM customer
WHERE CURDATE() NOT BETWEEN CheckIn AND Checkout
Comments