Link to home
Start Free TrialLog in
Avatar of gianitoo
gianitoo

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of BillAn1
BillAn1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FDzjuba
FDzjuba

SELECT PlayerName FROM PlayerTable WHERE SuspendData>getdate()
I think you need three date filters:

SELECT *
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
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 :-)
Avatar of gianitoo

ASKER

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