Level 8
´$query->selectRaw('distinct(id)');´
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello. I want to make query with Query Builder for returning rows with distinct columns. For example:
SELECT
DISTINCT ip,
DATE(FROM_UNIXTIME(unix_time)),
location_id
FROM test_table
This MySQL query returns unique triples from test_table for each day. But i could not do it with Laravel/Lumen Query Builder. Thank you in advance!
NOTE: I use mongoDB.
Please or to participate in this conversation.