How to count underage employees?

Asked

Viewed 59 times

1

I use the code below to display the number of active employees:

{{ $relatorio->Empresa->Funcionario->where('id_status', 1)->count() }}

How do I count only employees under the age of 18?

in the employee table I have the date of birth in the format date "2000-09-23"

1 answer

0

Most databases, the Where clauses accept more than one parameter. Cassi was the one who made this class select, make sure it accepts more parameters. This second paramatro would be: SELECT * FROM table WHERE id_status = 1 and colunaDataNascimento::date < '".dates("Y-m-d",strtotime ("-18 years"))."' -- deve estar em ISO-8601 format, YYYY-MM-DD

Browser other questions tagged

You are not signed in. Login or sign up in order to post.