Quantcast
Channel: THWACK: All Content - Network Performance Monitor
Viewing all articles
Browse latest Browse all 21870

SQL Expressions

$
0
0

Hi Thwack community

 

 

I´m using these sql expressions to get date like below:

 

 

Last 30 days

BETWEEN dateadd(month, -1, getdate()) and getdate()

This month

DateTime between  (DATEADD(m, DATEDIFF(m, 0, getdate()) , 0)) AND (DATEADD(dd, DATEDIFF(dd,0, getdate()), 0))

Last Month

DateTime between  (DATEADD(m, DATEDIFF(m, 0, getdate()) -1 , 0)) AND (DATEADD(m, DATEDIFF(m, 0, getdate()) , 0))

Yesterday

DateTime BETWEEN (DATEADD(dd, DATEDIFF(dd,0, getdate()) -1, 0)) AND (DATEADD(dd, DATEDIFF(dd,0, getdate()) , 0)))

 

 

 

 

I´m looking for sql expressions to get:

this year

last year

last 7 days

 

 

Thanks a lot


Viewing all articles
Browse latest Browse all 21870

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>