mardi 7 juin 2022

How to write brackets in sql command with laravel

I am new to laravel and eloquent , and I want to make a query to the DB (MySQL). I have this code.

$all_list_Active = TableA::select("id", "name_display", "short_name")->orderBy('name_display', 'ASC')->get();

and the issue that I need to change the query for this in MySQL:

select distinct TableA.id,TableA.name_display,TableA.short_name
from TableA
inner join TableB on TableB.account_id = TableA.id
AND TableB.id 
IN(SELECT id
FROM TableC
group by id, status
having count(*)>0 and status = 1) order by TableA.name_display ASC;

I am not understand how to write fully mysql in the laravel as string? is their an option to run this query in laravel



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

Aucun commentaire:

Enregistrer un commentaire