Log message #4124930

# At Username Text
# Mar 14th 2018, 12:47 lorenzo There is no subquery there
# Mar 14th 2018, 12:47 lorenzo Of course
# Mar 14th 2018, 12:47 narendravaghela but this is not the desired sql output, it returns only 11 rows, but there are total 41 rows
# Mar 14th 2018, 12:46 narendravaghela @lorenzo I ended up with https://gist.github.com/narendravaghela/9f706ed532403f478d6bcd1f4abac527
# Mar 14th 2018, 12:21 dakotairene :wave:
# Mar 14th 2018, 12:18 narendravaghela `Method newExpr does not exist `
# Mar 14th 2018, 12:16 narendravaghela trying..
# Mar 14th 2018, 12:16 lorenzo `innerJoin(['TL' => $subQuery], function ($q) { return return $q->newExpr()->equalFields('TL.id', 'TimeLogs.id'); })`
# Mar 14th 2018, 12:15 narendravaghela okay
# Mar 14th 2018, 12:15 lorenzo start by adding those
# Mar 14th 2018, 12:15 lorenzo well, you are missing the `having` and I told you to use `innerJoin`
# Mar 14th 2018, 12:15 narendravaghela this is native sql query to achieve all rows with groupby
# Mar 14th 2018, 12:14 narendravaghela ```sql SELECT si1.* FROM sold_items AS si1 JOIN (SELECT member_id FROM sold_items GROUP BY member_id HAVING SUM(amount) > 50) AS si2 ON si1.member_id = si2.member_id
# Mar 14th 2018, 12:14 narendravaghela I am little bit confused here, not getting an idea of working solution
# Mar 14th 2018, 12:13 lorenzo why `leftJoinWith` ?
# Mar 14th 2018, 12:12 narendravaghela that is the goal
# Mar 14th 2018, 12:12 narendravaghela There is a TimeLogs table, I want all rows and also want the sum of hours group by particular date
# Mar 14th 2018, 12:12 narendravaghela @lorenzo here is gist - https://gist.github.com/narendravaghela/9f706ed532403f478d6bcd1f4abac527
# Mar 14th 2018, 12:08 narendravaghela let me try myself, or I will share my code
# Mar 14th 2018, 12:07 lorenzo the last `where(...)` could be something like `where(function ($q) { return $q->newExpr()->equalFields('c1.id', 'Things.id')})`
# Mar 14th 2018, 12:07 narendravaghela @lorenzo thanks
# Mar 14th 2018, 12:06 lorenzo that’s how you join a subquery on the same contained table…. or whatever table
# Mar 14th 2018, 12:05 lorenzo @narendravaghela `$usersTable->find()->contain('Things')->innerJoin(['c1' => $commentsTable->find()->where(…)])->where(…)`
# Mar 14th 2018, 12:04 xinobi lorenzo exactly
# Mar 14th 2018, 12:03 lorenzo password hashers use a lot of cpu
# Mar 14th 2018, 12:02 xinobi I seriously don't understand why it should be spent cpu processing time with $hasher = $this->passwordHasher(); within _findUser method comments say: //helps mitigate timing attacks that are attempting to find valid usernames. Why not using a modeless validator?
# Mar 14th 2018, 12:01 ghoritrilochan neon 1024 any idea for this problem
# Mar 14th 2018, 12:00 narendravaghela how can I achieve the same query with Cake ORM?
# Mar 14th 2018, 12:00 narendravaghela https://stackoverflow.com/questions/28158083/mysql-group-and-total-but-return-all-rows-in-each-group?rq=1
# Mar 14th 2018, 11:59 narendravaghela right, and for that I need subquery
# Mar 14th 2018, 11:58 neon1024 Group will always reduce the size of the result set
# Mar 14th 2018, 11:58 neon1024 If I understand, that’s not possible.
# Mar 14th 2018, 11:58 narendravaghela let me try contain
# Mar 14th 2018, 11:58 narendravaghela and also want all the rows.
# Mar 14th 2018, 11:58 narendravaghela I want to fetch all all entries from a table with group by
# Mar 14th 2018, 11:57 ghoritrilochan shreehariji.com
# Mar 14th 2018, 11:57 neon1024 You can contain the same table as long as it’s alias is unique
# Mar 14th 2018, 11:57 ghoritrilochan https://b4umusic.000webhostapp.com/shreehariji/
# Mar 14th 2018, 11:57 ghoritrilochan hii.. my project live in two different server but one proper work and other in not work plz help..
# Mar 14th 2018, 11:57 narendravaghela contain the same table?
# Mar 14th 2018, 11:57 neon1024 Perhaps you’re looking for `contain()` ?