我在MySQL中有一个查询,需要更改为Lavarel。
如何在Laravel中进行此查询:
select distinct (
select distinct
products.name
FROM
products
join topics on topics.product_id = products.id ) AS product
from
contents c
join content_topics on content_topics.content_id = c.id
join topics b on b.id = content_topics.topic_id
where contents.id = 778;
据解释,它是关于原始查询的原始记录。https://laravel.com/docs/5.8/database#running-queries