how to get data for last 6 months in sql code example Example: sql where last 12 months select Dateadd(Month, -12, GETDATE())