So, I have this query which selects the number of rows in the past 30 days:
SELECT COUNT( DATE_FORMAT( created_at, '%m/%d/%Y' ) ) FROM enc_encounters WHERE created_at BETWEEN NOW() - INTERVAL 30 DAY AND NOW()";
I am trying to recreate this via query builder as such:
$result = $this->select('DATE_FORMAT( created_at, \'%m/%d/%Y\' )')->whereBetween('created_at', ['NOW() - INTERVAL 30 DAY', 'NOW()'] )->count();
I am receiving a result of 0 (It is meant to return 3).
Any idea on where I am going wrong?