I'm trying to do a complex sql where clause, so i'm using the Medoo::raw().
The issue is in with the $where argument for the $db->count() function, it just doesn't build the where clause:
$result = $db->debug()->count(
$this->table,
Medoo::raw(
"WHERE
<user> = :user
AND
(
(
YEARWEEK(<date>) = YEARWEEK( CURDATE() )
AND DAYOFWEEK(<date>) = 1
)
OR
(
YEARWEEK(<date>) = YEARWEEK( CURDATE() ) + 1
AND DAYOFWEEK(<date>) = 1
)
)", [":user" => $user]));
Count debug output:
SELECT COUNT() FROM `table_name`
But using $db->select() it does indeed build the raw sql:
Hi there,
I'm trying to do a complex sql where clause, so i'm using the
Medoo::raw()
. The issue is in with the$where
argument for the$db->count()
function, it just doesn't build the where clause:Count debug output:
But using
$db->select()
it does indeed build the raw sql:Select debug output:
Is this the supposed behaviour? Would be awesome if the Medoo aggregate functions would build the raw sql