samedi 8 janvier 2022

How to get less than data of selected month of year in laravel?

i have a table where all data of students. i need only less than month data of selected month of year. i have date column data like these.

registrationdate
2022-01-31
2021-12-01
2022-07-01
2021-11-12
2021-10-10
2022-01-07 
2020-08-26

if I select month 12 and year 2021 I need only previous data of December 2021

$month=12 and $year =2021

$selectedmonthMalestudents  = \DB::table('students')
                   
        ->whereRaw('extract(month from registrationdate) = ?','<' [$month])
        ->whereRaw('extract(year from registrationdate) = ?', [$year])
        ->count();

Please Help me How to do these...



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3qfM60h
via IFTTT

Aucun commentaire:

Enregistrer un commentaire