(DateDiff(dd, ISNULL(x.CDate, '1/1/1900'), y.DDate) > 5)

# Understanding Line in SQL Statement

Page 1 of 1## 3 Replies - 1130 Views - Last Post: 11 October 2012 - 07:57 AM

### #1

# Understanding Line in SQL Statement

Posted 11 October 2012 - 06:37 AM

I have recently started learning more and more about SQL, but this statement has me confused. If you could tell me what this means that would be great. Thanks!!

##
**Replies To:** Understanding Line in SQL Statement

### #2

## Re: Understanding Line in SQL Statement

Posted 11 October 2012 - 07:10 AM

Just break it down.

(DateDiff '-- you want to read about datediff here.

(dd, '-- from that link dd is day.. so are getting the number of days between two dates.

ISNULL('-- you should read about isnull here.

x.CDate, '-- some column name

'1/1/1900') '-- if that column is null then use this date.

, y.DDate) '-- find the number of days between x.CDate (or 01/01/1900 if x.Cdate is null) to y.Ddate

> 5)

'-- if that number of days between said dates is greater than five return true or else false.

(DateDiff '-- you want to read about datediff here.

(dd, '-- from that link dd is day.. so are getting the number of days between two dates.

ISNULL('-- you should read about isnull here.

x.CDate, '-- some column name

'1/1/1900') '-- if that column is null then use this date.

, y.DDate) '-- find the number of days between x.CDate (or 01/01/1900 if x.Cdate is null) to y.Ddate

> 5)

'-- if that number of days between said dates is greater than five return true or else false.

### #3

## Re: Understanding Line in SQL Statement

Posted 11 October 2012 - 07:44 AM

modi123_1, on 11 October 2012 - 07:10 AM, said:

Just break it down.

(DateDiff '-- you want to read about datediff here.

(dd, '-- from that link dd is day.. so are getting the number of days between two dates.

ISNULL('-- you should read about isnull here.

x.CDate, '-- some column name

'1/1/1900') '-- if that column is null then use this date.

, y.DDate) '-- find the number of days between x.CDate (or 01/01/1900 if x.Cdate is null) to y.Ddate

> 5)

'-- if that number of days between said dates is greater than five return true or else false.

(DateDiff '-- you want to read about datediff here.

(dd, '-- from that link dd is day.. so are getting the number of days between two dates.

ISNULL('-- you should read about isnull here.

x.CDate, '-- some column name

'1/1/1900') '-- if that column is null then use this date.

, y.DDate) '-- find the number of days between x.CDate (or 01/01/1900 if x.Cdate is null) to y.Ddate

> 5)

'-- if that number of days between said dates is greater than five return true or else false.

Thanks for your Reply. I am somewhat new to SQL so I was just making sure I was reading it correctly.

### #4

## Re: Understanding Line in SQL Statement

Posted 11 October 2012 - 07:57 AM

Hmmm.. well next time I'll have to make you tell me what you think it says first. Also I just noticed this is mysql not mssql... the function explanation is the same but you may get a bit more mileage out of hitting up the mysql search bar.

Page 1 of 1