I am using Laravel Query Builder but if you guys have solution to the problem in plain MySQL, it would be ok as well.
I don't want to select records that are 4 hours apart from the current time, but instead what I do want is those records only which are 4 hours apart from each other. For example, row 1 is at 4PM, row 2 is at 6PM and row 3 is at 8PM, I only want to select row 1 and row 3.
A slight complexity though is that I want to add the above feature to the following query:
$data = new Main();
$data0 = $data->whereRaw('updated_at >= DATE_SUB(NOW(), INTERVAL 24 HOUR)')
->where(function ($query) {
$query->whereRaw('MINUTE(updated_at)>54')->orwhereRaw('MINUTE(updated_at)<6');
})
->where('server_short_name', '=', 'FiveRP')
->get();
So the above query fetches the records for the past 24 hours and only those records that have minutes at 54 or 6. I want an additional measure that fetches these queries at 4 hours apart from each other.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rYxG47
via IFTTT
Aucun commentaire:
Enregistrer un commentaire