タグ

ブックマーク / 5net.com (1)

  • DBIC で count したもので order by する方法 – klog

    Hatena::Diary::Neko::kak 500 Internal Server Error – countしたものにorder by http://en.yummy.stripper.jp/?eid=448071 DBICではたぶん発行するSQLのカラムに別名をつけられないみたいなので スカラーリファレンスでしかたないんじゃないすかね。 同じことで悩んだ時期もありましたが、いろいろ試してみた結果 order by 句に count(hoge) そのものを指定できることがわかりました。(少なくとも MySQLSQLite で動作確認済み) $rs = $schema->search( {}, { select => [ 'link', { count => 'entry' } ], group_by => [qw/ link /], order_by => 'count(li

    DBIC で count したもので order by する方法 – klog
    kamawada
    kamawada 2008/03/18
    これを探していた
  • 1