Solved

date diff query

Posted on 2004-08-12
7
212 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

776 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