Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

TSQL Syntax

Dear Experts

I have a table consisting of the following fields:

ref               int
issue           int
startdate     date/time
expdate      date/time

I would like to be able to select issue from the table where the expdate falls within the month after this month.  I understand I will have to use GETDATE to work out the current month but I am not sure on the correct syntax for this.

Can anyone help

Thanks

 
0
grantballantyne
Asked:
grantballantyne
  • 2
2 Solutions
 
LeDaoukCommented:
SELECT Issue
FROM Table
WHERE DATEDIFF(day, getdate(),expdate)  = 1
0
 
knightEknightCommented:
slight correction:

WHERE datediff( MONTH, getdate(), expdate ) = 1
0
 
LeDaoukCommented:
yeh sorry month
0
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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