大家好,我想问一下你们中是否有人知道如何使用 3 级子查询在推进器中创建选择语句......最初我有这个查询,它工作正常,但我希望它更像推进器类型......谁能帮我这个?
这是我的查询
select c.*, count(d.id) as like_count from (
select a.*, count(b.id) as points_count
from (
select *
from reviews
where user_id ='3') a
left join points as b on (a.id = b.type_id)
where b.type='review'
group by a.id
order by a.created desc) c left join `like` d on (c.id = d.type_id) group by c.id
这是我到目前为止所拥有的,但仅从 2 级子查询来看,输出查询不正确
$review = ReviewsQuery::create()->filterByUserId($user_id);
$points = PointsQuery::create('b')
->withColumn("COUNT(b.Id)", 'points_count')
->addSelectQuery($review, 'a', true)
->toString(); // This is just to check what will be the query output
谁能帮我解决这个问题