Tricky SQL Queries On Dates

Query to get the latest date:

Select item, max(inventory_ date)
from table
where inventory_date is < '6/30/2011'

Query to retrieve not more than 6 years from application date:

Select item from a table
where appl_date >= (Currentdate - 6 Years)

SQL Query to Selec a date between two dates:

WHERE CP.ActionDate 
BETWEEN '19/12/2012' 
AND '1/17/2013'

Relates Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.