How to count only once for a specified row even if the row exists more than once?
For instance I have a SQL query
SELECT COUNT(Date)
FROM mytable
WHERE name like '%John%'
But it counts all John's number. What I need is, if I find a name John
, I want to count only one time, no matter John's name exists more than once.
To illustrate
Name Date
John 06-09-2012 1am
Robert 06-09-2012 2am
John 06-09-2012 3am
John 06-09-2012 4am
Robert 06-09-2012 5am
Results should be 1 for John.