You could also just have SQL get the date component and ignore the time in the select statement. Or get the min() and max() in the same query that does the select and use those values in the select. If the date field is indexed it will take very little effort to get the min() and max(). If the field is not indexed SQL would have to read the entire table in which case using only the date part would be faster.
Ray Thompson Tau Beta Pi (www.tbp.org) The Engineering Honor Society 865-546-4578 -----Original Message----- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 2:23 AM To: SQL Subject: datediff vs. between I have some huge logs and I want to get specific data from them. I have 2 choices on how I can get all of the entries for a single day. The first choice is to do a datediff between the day I want and the date in the created field. The second is to do one query to get the min and max for a specific date and then do a second query to get all records between these two numbers. Logically, the first should be faster, but is it? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2439 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
