lundi 21 décembre 2015

get todays date with last 6 months back

I want the exact date as 22/06/2015` from the query

whose Joining date should be exact

22/06/2015

which is exact 6 months back from todays date

I tried like below

 Select date_of_joining,*  from emp_mst Where  Dt_Of_Join >= Dateadd(Month, Datediff(Month, 0, DATEADD(m, -6, getdate())), 0)

but it didn't worked.

what is the exact query for that ?

I am using SQL- server- 2005

Aucun commentaire:

Enregistrer un commentaire