troubleshooting Question

Recurrence dates SQL design and query

Avatar of fm250
fm250Flag for United States of America asked on
DatabasesMicrosoft SQL ServerMicrosoft SQL Server 2005
15 Comments2 Solutions1224 ViewsLast Modified:
I have a need for showing recurrence dates on training table based on true/false field for everyYear field.  And want to know how to handle that in SQL.

Here is the portion of the query that I need help with:
(this in Linq to Entities but I need it in T-SQL as L2E 3.5 won't handle it)

So I need to query the table and see
-      If it is every year (I got that) then next year and the years after I show the records based on the month for example
If the training start date july 1 to end date july 30 then the record is displayed no matter what the year is based on today’s date?
-      And also if the date taken is  within this year then records is not displayed
-      how do I handle a date from Dec 15 to Jan 15 (this is going to be the next year)
DateTime today = DateTime.Today.Date;
From  t in  db.train
 from l in t.Trainees

Where today >= l.DateStarted && today <= l.DateEnded 

Where not in ( ut.Passed == true && ut.DateTaken  > l. DateEnded.Last year )
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros