I am using this query:
SELECT p.id, count(clicks.ip)
FROM `p`
LEFT JOIN c clicks ON p.id = clicks.pid
WHERE clicks.ip = '111.222.333.444'
To select clicks from table "c", that has "pid" = "p.id". The query seems to work fine, but now I want to use that query with date ranges. The "c" table has a column "time" that uses MySQL CURRENT_TIMESTAMP data type (YYYY-MM-DD HH:MM:SS). How can I use my query with date range using that column?
I want to be able to select count(clicks.ip) from a specific day, and also group the results by hour (but this is for a different query).