-4

I'm currently a novice sql user with relatively low (self-taught) knowledge.

I currently have a query whereby I can view the contract start date of our clients. What I would like, is a custom column showing the number of days post contract start date. For example:

Start Date | Days Since Contract Start

04/02/2016 | 404 days

Please could somebody show me how this is possible?

Thanks! Dan

John Conde
  • 217,595
  • 99
  • 455
  • 496
Daniel Cox
  • 1
  • 1
  • 1
  • Please do not use tags that do not apply to your question. – John Conde Mar 14 '17 at 12:04
  • 1
    Welcome to [so]! Looks like you need to learn more about what is expected of users here. You're expected to try to **write the code yourself**. After [doing more research](http://meta.stackoverflow.com/questions/261592) if you have a problem you can **post what you've tried** with a **clear explanation of what isn't working** and providing a [**Minimal, Complete, and Verifiable example**](http://stackoverflow.com/help/mcve). I suggest reading [ask] a good question and [the perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/). Also, be sure to take the [tour]. – John Conde Mar 14 '17 at 12:05
  • @JohnConde hmmm.... how do you decide which of two initial tags to remove? Probably OP uses sql server, not mysql. ;) – Andrey Korneyev Mar 14 '17 at 12:06
  • #@AndyKorneyev Honestly, I should have changed this to just have the SQL tag. – John Conde Mar 14 '17 at 12:07
  • 1
    Possible duplicate of [SQL count consecutive days](http://stackoverflow.com/questions/26117179/sql-count-consecutive-days) – brclz Mar 14 '17 at 12:21

1 Answers1

2

Have you tried anything? As pointed out by Johns comments, this is not enough information for a good question. However I am presuming you want the DateDiff function.... Like so in MySQL;

DateDiff(StartDate, CURRENT_DATE())

Or

DateDiff(StartDate, GetDate())

in MSSql

Milney
  • 6,253
  • 2
  • 19
  • 33