I need to make a MySQL query that does the following:
Count the number of times that the same record appears with a difference greater than 15 days, that is:
- Record 1 - Date: 01/20/2015
- Record 2 - Date: 01/22/2015
- Record 3 - Date: 03/03/2015
In this case it would be 2 because it would count 1, 3 and would neglect 2 because the difference between 1 and 2 is less than 15 days.
I tried to mount the following but it does not work:
UPDATE 'logpro' SET 'log'= (SELECT data, count(CAId) From 'logpro'
Group by FLOOR(LOG(Datepart(day, data))/LOG(15))