SELECT count(id) FROM users WHERE DATEDIFF(eventtime,GETDATE(),d) == 1; Or something along those lines, all the date functions are very well documented in the "digital books" that come with Enterprise Manager. Open up the reference, and search for datediff, and there should be a link in there for the date functions as a whole.
On Tue, 2004-03-16 at 10:32, Adam Williams wrote: > I've used mysql a little, but now I'm working with a MS SQL SERVER 2000 > database. We have a proprietary application/hardware setup where > when a person enters the building, the time they enter the building > is automatically put into the database in a field called eventtime, and > their access card is entered in a field called cardnum. The > time entered is like the mysql NOW() function (i dunno what its called in > mssql), the format is YYYY-MM-DD HH:MM:SS.000 anyway. I need to write an > SQL query that will get a unique count of cardnum based on how many times > the person enters a building each day. So I need to do some sort of > UNIQUE (although in mssql I think its distinct) count on the YYYY-MM-DD > and ignore the HH:MM:SS.000, but looking at the mssql reference book I > have, it doesn't go into great detail on date functions, so I was > wondering if anyone knows how to do a unique on the eventtime with > the date and ignore the time. -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php