Mysql count with condition <p>I have a table like this:</p> <pre><code>+---------------+--------+-----------------+ | ReservationID | UserID | ReservationDate | +---------------+--------+-----------------+ | 1 | 10002 | 04_04_2016 | | 2 | 10003 | 04_04_2016 | | 3 | 10003 | 07_04_2016 | | 4 | 10002 | 04_04_2016 | | 5 | 10002 | 04_04_2016 | | 6 | 10002 | 06_04_2016 | +---------------+--------+-----------------+ </code></pre> <p>I use this query to count how many reservation each of my user have:</p> <pre><code>SELECT UserID, COUNT(UserID) as Times FROM mytable GROUP BY UserID ORDER BY Times DESC </code></pre> <p>And It gives me this result:</p> <pre><code>+--------+-------+ | UserID | Times | +--------+-------+ | 10002 | 4 | | 10003 | 2 | +--------+-------+ </code></pre> <p>However I want to count one if my user has more than one reservation in specific date. For example User 10002 has 3 reservation at 04-04-2016, It should be count 1. And I want to get this result:</p> <pre><code>+--------+-------+ | UserID | Times | +--------+-------+ | 10002 | 2 | | 10003 | 2 | +--------+-------+ </code></pre> <p>How can I can get it?</p> <p>Thanks</p>