tsql - Beginner: Checking availability on a booking table in SQL -


I'm writing a job vacancy database for a little fun (and to learn and learn T-SQL / SQL Server) This is in my application table so far.

  application_id name from the interviewer location_ id ---------------------- ------------- ------------------------------------- ------------- ---------------------- 1 Blogs All Saunders 100 2008-12-25 00:00: 00 2008-12-26 00:00:00 2 Barry White Issac Hayes 100 2008-12-29 00:00:00 2008-12-30 00:00:00  

It's easy enough to find out that for these dates Which booking has been done; A simple selection statement will easily get them well.

I still have the only problem that it is to find out that bookings are not included during the day. I want to do a search on the following table to see what dates are available in the room with the location_ID 100 "2008-12- 25 00:00:00" and "2008-12-30 00:00:00" And have returned it that no interview is being conducted from 27th to 28th in the room.

I'm sure this is very easy, but please give me some SQL knowledge.

Similarly:

one way this could be That is, keep the date range in a table variable and join it.

  Declare @startDate datetime, @endDate datetime SET @startDate = '2009-05-01' SET @endDate = '2009-05-31' Announce the dots table (Date Date) @ Date value (@startDate) while @startDate & lt; @endDate set @startDate = @startDate + 1 @date values ​​(@startdate) Finally insert d. Choose from applications * After joining a left, between d.date on @ dates a.from and a.to where a.application_id is zero  

not tested, but such There may be some work


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -