Re: Date Indexing

2004-09-23 Thread Don Read
On 23-Sep-2004 Eamon Daly wrote: > I'm interested in this, too. We have a logging table that > sees hundreds of rows per second, and we do a ton of monthly > reports. We just bit the bullet and added an indexed DATE > column. Is there a better strategy? > I do something similar but with MEDIUMIN

Re: Date Indexing

2004-09-23 Thread Eamon Daly
Daly - Original Message - From: "Andrew Kreps" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 22, 2004 4:48 PM Subject: Date Indexing Hey all, I have a question about indexing part of a date field. I have a query that I run on a regular basis to ret

Re: Date Indexing

2004-09-22 Thread Michael Stassen
If you want to use the index, you cannot put the column through any function. You have to compare the column value, as is, to constants. For example, SELECT SUM(OrderSubTotal) FROM tblOrders WHERE ShipDate BETWEEN '2004-09-01' AND '2004-09-30'; should do what you want. Michael Andrew Kreps

Date Indexing

2004-09-22 Thread Andrew Kreps
Hey all, I have a question about indexing part of a date field. I have a query that I run on a regular basis to retrieve monthly sales numbers: SELECT SUM(OrderSubTotal) FROM tblOrders WHERE DATE_FORMAT(ShipDate, '%Y-%m') = '2004-09'; ShipDate is a date field. My question is how I can phrase th