Question

i have two tables. first table passenger_info has information regarding passengers and second table seat_no has only one field which is seat_no.

now i need to get the seats nos in seat_no field but all only all those which are not yet assigned to any passenger. this is checking the group_id and br_id in subquery with forms selected values and then the resultant value is further compared with the master query. is this value is present in not presant with the comparison of master query then this seat no is selected for seat_no field in passenger_info table and doing this way when whole query is processed. all the non-assigned seats nos are listed in the seat_no field combobox on the passenger_info form.

so i wtore this query which has some small mistake. by figuring it i could solve this issuse.

 select seat_no.seat_no 
 FROM Seat_No 
 where seat_no.seat_no 
           ( 
             SELECT Pasenger_Detail.Seat_No 
             FROM Pasenger_Detail 
             WHERE (((Pasenger_Detail.Group_ID)=forms!Pasenger_Detail!Group_ID)
             And ((Pasenger_Detail.BR_ID)=forms!Pasenger_Detail!BR_ID))
           )               
  is null;
Was it helpful?

Solution

This should do the trick (assumes seat_no is the same data type in both tables):

select seat_no.seat_no 
FROM Seat_No 
where seat_no.seat_no NOT IN
       ( 
         SELECT Pasenger_Detail.Seat_No 
         FROM Pasenger_Detail 
         WHERE (((Pasenger_Detail.Group_ID)=forms!Pasenger_Detail!Group_ID)
         And ((Pasenger_Detail.BR_ID)=forms!Pasenger_Detail!BR_ID))
       )               
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top