View Full Version : Previous Year Query


TVReplay99
02-25-2002, 01:25 PM
I feel really stupid asking this and I sure it is just a mental block but, I nees to yun a summary of last years sales from the [Sales] table with date from several years. I cant think of how to run a query that selects all sales from the previous year. The [Sales].[Date] field is formated mm/dd/yyy. Please helpmy get past this mental road block.

Brian

Alexandre
02-25-2002, 01:32 PM
By previous year, do you mean last year ?

SELECT Sales.*
FROM Sales
WHERE (((Year([DateField]))=Year(Date())-1));

Note that you should not use reserved names like Date for you DB objects (hence my: DateField)

Alex

[This message has been edited by Alexandre (edited 02-25-2002).]

TVReplay99
02-25-2002, 02:17 PM
Thank you, thank you, thank you. Just having one of those days.