Solved

date diff query

Posted on 2004-08-12
7
209 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:gianitoo
7 Comments
 
LVL 17

Accepted Solution

by:
BillAn1 earned 500 total points
ID: 11788852
select * from playertable
where suspendeddate > getdate()
0
 
LVL 7

Expert Comment

by:FDzjuba
ID: 11788951
SELECT PlayerName FROM PlayerTable WHERE SuspendData>getdate()
0
 
LVL 15

Expert Comment

by:jdlambert1
ID: 11790009
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
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Expert Comment

by:amulya_333
ID: 11791397
I go with BillAn1 's answer. That's the solution.
0
 
LVL 7

Expert Comment

by:FDzjuba
ID: 11791769
maybe i don't get something, why is this question is 500 points?
0
 
LVL 17

Expert Comment

by:BillAn1
ID: 11791779
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 :-)
0
 
LVL 1

Author Comment

by:gianitoo
ID: 11792032
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
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How does this SELECT query work 11 99
MS SQL - Conversion failed when converting the varchar value 3 22
Export import database 4 39
TSQL DateADD update Question 4 24
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now