need ur help again
i have a sql table with column docid,proposedcompletiondate,docstatus
doc_id ProposedCompdate Docstatus
0001 2011-10-30 A
0002 2011-11-29 C
0003 2011-10-31 C
0004 2011-10-30 A
0005 2011-10-30 C
0006 2011-10-28 C
0007 2011-10-25 A
0008 2011-10-30 C
Now i want to write a query to fetch results with Docstatus 'A' whose date when subtracted by 9 days should be current date
for eg if todays Date is ’21-10-2011′
the resultset must be
doc_id ProposedCompdate Docstatus
0001 2011-10-30 A
0004 2011-10-30 A
This is assuming Microsoft SQL Server, but your where clause would be:
The DateDiff function takes a measurement parameter (day, year, etc), a beginning date and and end date and returns an integer. So the difference between today and ProposedComplete should be 9 days.