mssql query
| From: | Adam Williams | Date: | Tue, 16 Mar 2004 15:32:57 +0000 |
| Subject: | mssql query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33466@lists.php.net to get a copy of this message | ||
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.