J.B.
J.B.

Reputation: 278

Determine how long a customer has been in a database table

I have a customer table and the only column I have to work with is the date column. The customer's record is inserted into this table and only removed from it upon a certain action. I am trying to figure out a query that would show me exactly how long said customer has been in this table using only a date field.

Upvotes: 0

Views: 165

Answers (1)

Adriano Carneiro
Adriano Carneiro

Reputation: 58615

This will tell you how many days each record has been passed since the date indicated in your DateField:

select dateDiff(day, DateField, GetDate()) from YourTable

For more information, read more about DateFiff

Upvotes: 3

Related Questions