1. Bogdan Varlamov
  2. 2013_03_23

Commits

Bogdan Varlamov  committed 2b27b5f

adding the more robust query which eliminates the problem of false positives from multiple reservations for the same room

  • Participants
  • Parent commits cabd603
  • Branches master

Comments (0)

Files changed (1)

File 3_ExtendedAnswer.sql

View file
+--can't declare variables in sql ce
+-- so i've got the dates hardcoded in there for this example
+
+
+--we want all the room numbers that aren't in the conflict set
+SELECT 	RoomNum
+FROM 	Reservations
+WHERE	RoomNum NOT IN
+(--this get's all of the conflicting reservations
+	SELECT        RoomNum
+	FROM          Reservations AS innerRS
+	WHERE        (Start BETWEEN '2013-02-14' AND  '2013-02-17')
+			  OR ([End] BETWEEN '2013-02-14' AND '2013-02-17')
+)