$count=DB::table('last_checks')
  ->select(DB::raw('COUNT(DISTINCT last_checks.user_id) as count'))
  ->leftJoin('users','last_checks.user_id', '=', 'users.id')
  ->where('floor(Year(now())-users.age)/10)',2)
  ->where('last_checks.last_item_id', $item[$i]->id)

floor(YEAR(now())-users.age)/10) 这不能得到

我得到的错误是:

SQLSTATE [42S22]:未找到列:1054未知列'Floor((年(现在()) - 年龄)/ 10)'在'where子句'(SQL:选择COUNT(DISTINCT last_checks.user_id)作为来自last_checks的计数在last_checks.user_id = users.id上留下加入用户,其中Floor((年(现在()) - 年龄)/ 10)= 2和ANDlast_checks.last_item_id = {“id”:69,“content”:“\ uc815 \ ud6c8 \ uc2a4“,”last_vote_id“:34,”point“:3,”created_at“:null,”updated_at“:null}限制1)