D
D
Denis2021-07-27 16:37:38
MySQL
Denis, 2021-07-27 16:37:38

Laravel database query?

I am rewriting a raw query from an old project that we transfer to laravel and I am trying to implement the old query through the query builder. The queries look the same, I looked through the QueryLog , but the result is completely different. BD is also different. at the time of the request, I did a dump from the old database to the new one. And I don't understand what could be wrong?
here is the old query raw

"SELECT COUNT(*), `name` FROM `table` 
 WHERE (`TimeP1` > ? OR `TimeP2` > ? OR `TimeP3` > ? OR `TimeP4` > ?) 
 AND ((`Status`!= ? AND `Status`!= ?) OR (`Case_new` = ?)) 
 AND `del`= ? GROUP BY `name` ORDER BY `name` ASC"

here is the query via query builder which returned QueryLog
select count(*) as count, `name` from `table` 
 where (`TimeP1` > ? or `TimeP2` > ? or `TimeP3` > ? or `TimeP4` > ?) 
 and ((`Status` != ? and `Status` != ?) or (`Case_new` = ?)) 
 and `del` = ? group by `name` order by `name` asc


kind of all the same .... but the result is different ... why I don’t understand
, maybe it’s because of the versions of the database? the old database is like this
mysqld Ver 5.5.62 for Win64 on AMD64 (MySQL Community Server (GPL))
and the new one is like this
mysqld Ver 10.3.28-MariaDB for Linux on x86_64 (MariaDB Server)
I just don’t understand what else could be wrong. ..?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question