Computer Science, asked by Ranjitsinghvirk425, 11 months ago

Write a query to display the number of sales that were made in the last 40 months

Answers

Answered by sachin7318
3

Explanation:

D Da tsagdf. hahaha hv ugVha ja hv cab

Answered by Anonymous
1

SQL query to display the number of sales that were made in the last 40 months is:

  • Method I - Using DATEADD

SELECT *  

FROM TABLE_NAME

WHERE Date_Column >= DATEADD (MONTH, -40, GETDATE() )

  • Method II where DATEADD isn't supported:  

SELECT *  

FROM TABLE_NAME

WHERE Date_Column >= DATE_ADD( NOW() , INTERVAL -40 MONTH )

Similar questions