SinghWithLaravel
3 months ago
700
1
Lumen

How to write SubQuery in Laravel 5.8 ?

Posted 3 months ago by SinghWithLaravel

I want to write subquery in laravel 5.8, what are the ways and which one is best ? I need to convert below query into laravel query. -

SELECT "assetId",id,
    (
        SELECT recording.usage from recording where recording."assetId"=asset.id ORDER BY id DESC LIMIT 1
    )
FROM asset; 

Please sign in or create an account to participate in this conversation.