samedi 27 juillet 2019

How to run a subquery with alias in Laravel?

I have the following query which I am struggling to use in Laravel. DB::raw() is there but can't figure out how to set the subquery.

SELECT * from products
where status = 1
AND
id IN (
   SELECT * FROM (
            SELECT `product_id` 
            FROM `order_product` 
        order by `id` desc limit 8
        ) as T
)

I am using Laravel 5.6



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OjZqPX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire