Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Column Date Report

Status
Not open for further replies.

gbrigman

IS-IT--Management
Mar 7, 2002
13
US
I have a query that runs against several tables and return all records for a date range. I need a report that has this information on it for 4 different date ranges.

Last Month
Year to Date
Last Year Last Month
Last Year Year to Date

Is this possible?
 
Assuming you are adding numbers. Try something like

Select F1, F2, F3.....
, Iif( RecordDate between BeginMonth and End_Month), AmountField, 0) as LastMonth
, Iif( RecordDate >= BeginYear), AmountField, 0) as YTD
, Iif( RecordDate between BeginMonthLastYear and End_MonthLastYear), AmountField, 0) as LastYearLastMonth
,Iif( RecordDate between BeginLastYear and EndLastYear), AmountField, 0) as LastYear

From .....

Hope this helps

Regards
Warwick


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top