Dear guys:
i'm developing a booking system for a clinic, so my problem is that i want to display available doctor shift which are not already reserved, the patient check the availability of a certain doctor in specific date and shift.
i have 2 tables Booking (ID, DocID, shift_id, Date)and Shift table (ID, name, DocID)
my SQL selecting query which r not working is:
SELECT Shift.ID, Shift.name, Shift.DocID
FROM Shift INNER JOIN
Booking ON Shift.ID = Booking.shift_id
WHERE (Shift.DocID = @DoctorID) AND (Booking.DocID <> @DoctorID) AND (Booking.shift_id <> @ShiftID) AND (Booking.Date <> @VisitDate)
so please any ideas???
Selecting between tables
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 29, 2011, 9:40 AM EST
Please provide some sample data for both tables and the information you are passing in the parameters (alsoif you can provide expected output based on the data)
Mohamed Shehab4 reputationPosted Nov 30, 2011, 5:25 AM EST