2015-05-14 88 views
-3

我有兩個表,即 roominfo和guestrecordtransac ... roominfo containd ROOM_ID,room_no和roomtype領域 而guestrecordtransac包含ID,roomtype,roomno,checkindate,checkoutdate領域如何從表中獲取不在其他表中的記錄?

我試過這樣

select room_no FROM roominfo WHERE room_no NOT IN (select roomno from guestrocordtransac where roomtype='".$roomtype."' between '".$check_in."' and '".$check_out."' 
) and roomtype='".$roomtype."' 

我想room_no從特定類型的房間信息,並且不在登記和結帳日期之間

回答

0

(您的問題不清楚,請嘗試給予更明確的信息)

我覺得這有點像你需要/問什麼:

select room_no FROM roominfo WHERE room_no NOT IN (select roomno from 
guestrocordtransac where roomtype='".$roomtype."' 
AND CURDATE() between '".$check_in."' and '".$check_out."`' 
+0

無其不工作...它的K I得到它.... – user12688

相關問題