Ilya Poluhin
Ilya Poluhin

Reputation: 45

Postgres function WITH in Laravel QueryBuilder

please help me.

I've got the raw SQL

WITH collections AS (
    SELECT 
        ...
    FROM
        ...
)
SELECT
    ...
FROM collections c1
LEFT JOIN collections c2
    ...

How I can write it using Laravel QueryBuilder?

Upvotes: 0

Views: 2673

Answers (1)

Rav
Rav

Reputation: 1387

You may use the RAW method of Laravel's Query Builder (https://laravel.com/docs/5.3/queries#raw-expressions). Just be careful with potential SQL injection loopholes.

Upvotes: 1

Related Questions