Level 102
DB::selectRaw('SELECT DISTINCT json_t.id
FROM my_table,
JSON_TABLE(my_table.array_ids, "$[*]" COLUMNS(id char(36) PATH "$")) AS json_t
WHERE my_table.array_ids IS NOT NULL')->get();
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have an SQL query that I want to convert to Laravel DB Query. But, I am unsure how to use Raw Query for Cross Joins.
SELECT DISTINCT json_t.id
FROM my_table,
JSON_TABLE(my_table.array_ids, "$[*]" COLUMNS(id char(36) PATH "$")) AS json_t
WHERE my_table.array_ids IS NOT NULL
Can someone please help me to convert this query into Laravel DB Query?
DB::selectRaw('SELECT DISTINCT json_t.id
FROM my_table,
JSON_TABLE(my_table.array_ids, "$[*]" COLUMNS(id char(36) PATH "$")) AS json_t
WHERE my_table.array_ids IS NOT NULL')->get();
Please or to participate in this conversation.