• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • 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

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

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