小编sna*_*hot的帖子

教条 - 来自的子查询

我在MySQL中有一个查询:

SELECT * FROM (
    SELECT COUNT(*) AS count, t.name AS name
    FROM tag t
    INNER JOIN video_has_tag v USING (idTag)
    GROUP BY v.idTag
    ORDER BY count DESC
    LIMIT 10
) as tags ORDER BY name
Run Code Online (Sandbox Code Playgroud)

我想在学说中写这个.我怎么能这样做?我写:

Doctrine_Query::create()
        ->select('COUNT(t.idtag) as count, t.name')
        ->from('Tag t')
        ->innerJoin('t.VideoHasTag v')
        ->groupBy('v.idTag')
        ->orderBy('count DESC, t.name')
        ->limit(30)
        ->execute();
Run Code Online (Sandbox Code Playgroud)

但我不能把它放在"从"按名称排序.

php mysql doctrine

11
推荐指数
1
解决办法
1万
查看次数

标签 统计

doctrine ×1

mysql ×1

php ×1