jeudi 7 juin 2018

how get the lower dates Laravel and mysql

I have this laravel query to get all expired users from database

 $result = DB::table('radchecks as c')->leftJoin('radusergroup', 'c.username', '=', 'radusergroup.username')->whereRaw("DATE_FORMAT(c.expiration,'%Y-%m-%d') <= DATE_FORMAT('NOW()','%Y-%m-%d')")
->select('c.username', 'expiration')

->groupBy('c.username')
->get();

but this query return null even if there are expiration column with value

 01 june 2017 

but not return it . where is my wrong ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire