0

I have this raw query in MySQL I need to translate to laravel 5.5 query builder. Thanks

SELECT
group_table.id,
group_table.name,
group_table.description,
GROUP_CONCAT(
    group_table.languageName SEPARATOR ', '
) as languages
FROM
(
    SELECT
        translate_groups.id,
        translate_groups.name,
        translate_groups.description,
        languages.name as languageName
    FROM
        translate_groups
    LEFT JOIN language_translate_group ON
        language_translate_group.translate_group_id = translate_groups.id
    LEFT JOIN languages ON
        language_translate_group.language_id = languages.id
) group_table
GROUP BY
group_table.id,
group_table.name,
group_table.description
2

1 Answer 1

0

you can run any raw query you want in query builder:

$queryString = 'WHAT RAW QUERY YOU WANT';
$result = DB::select(DB::raw($queryString));

just make use of Illuminate\Support\Facades\DB;

Sign up to request clarification or add additional context in comments.

1 Comment

I need to translate to laravel 5.5 query builder. ( not collection)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.