Iknow this question is not asked well manner so i am sorry i have sql query this one
`SELECT
c.*
FROM
merchantlink m,
company c,
merchantlinkrelation mlr
WHERE
(m.initiator_user_id = c.owner_user_id AND
m.responder_user_id = 86 AND
mlr.ptype='dealer')
OR
(m.initiator_user_id = 86 AND
m.responder_user_id = c.owner_user_id AND
mlr.ptype = 'dealer')
OR
(m.initiator_user_id = c.owner_user_id AND
c.owner_user_id=86 AND
mlr.ptype='dealer')
GROUP BY
c.id;`
i wnat to convert it in php laravel query form so tried this query
$twowaycompany = DB::table('company')
->join('merchantlink','merchantlink.responder_user_id', 'company.owner_user_id')
->orWhere('merchantlink.initiator_user_id', 86)
->join('merchantlink','merchantlink.initiator_user_id', 'company.owner_user_id')
->orWhere('merchantlink.responder_user_id', 86)
->pluck('name')->toArray();
but i dont know sql and even i am not understanding how i convert it can some one help just convert sql query to laravel query?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3AhVC4H
via IFTTT
Aucun commentaire:
Enregistrer un commentaire