SQLSTATE[42S22] i have problem sql in laravel..

Posted 7 months ago by amin93je

Error code

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'YEAR(CURRENT_TIMESTAMP) - YEAR(seeker_DOB) BETWEEN 18 AND 17' in 'where clause' (SQL: select count(*) as aggregate from `job_seekers` where seeker_gender LIKE "%%" and seeker_state LIKE "%%" or `YEAR(CURRENT_TIMESTAMP) - YEAR(seeker_DOB) BETWEEN 18 AND 17`

my code

  $seeker = job_seeker::selectRaw('*, YEAR(CURRENT_TIMESTAMP) - YEAR(seeker_DOB) AS ages')
                            ->whereRaw('seeker_gender LIKE "%'.$request->input('dd-gender').'%"')
                            ->whereRaw('seeker_state LIKE "%'.$request->input('dd-state').'%"')
                            ->orWhere('YEAR(CURRENT_TIMESTAMP) - YEAR(seeker_DOB) BETWEEN 20 AND 30')
                            ->orderby('created_at', 'DESC')->paginate(15);

the problem is i cant use `YEAR(CURRENT_TIMESTAMP) - YEAR(seeker_DOB) , because its this..

Please sign in or create an account to participate in this conversation.