• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

date diff query

lets say i have a database with player names and a date where the player will suspended until.

how can i query my database so when the date is past due then the player will not show in my query anymore.  

so if   Giancarlo Barraza will be suspended from   january 1, 2004   to  august 12, 2004    then in august 13, 2004 i do not want to include him in the results.
1 Solution
select * from playertable
where suspendeddate > getdate()
SELECT PlayerName FROM PlayerTable WHERE SuspendData>getdate()
I think you need three date filters:

FROM PlayerTable
WHERE SuspensionStartDate IS NULL  --this keeps players without a suspension
 OR SuspensionStartDate > GetDate() --this keeps players whose suspensions haven't started yet
 OR SuspensionEndDate  < GetDate() --this keeps players whose suspensions have ended
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

I go with BillAn1 's answer. That's the solution.
maybe i don't get something, why is this question is 500 points?
The points reflect how important the answer is to the person asking the question, not necessarily how 'difficult' the question is. That's the cut and thrust of the market economy I guess :-)
gianitooAuthor Commented:
500 points because it was very critical for me to get this answer right away.    Importance was extremely high and because of great people like you i was able to meet my web project deadline.....

peace and love
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now