我在组标签中发现了一个问题:有什么解决办法吗?
下面是我查询语句:任何帮助. def趋势标记(用户)
@tags= HashTag.joins(:vibe_hash_tags).limit(10).where('hash_tags.created_at BETWEEN ? AND ?', 1.months.ago, Time.now).select("hash_tags.id, hash_tags.address as country, count(vibe_hash_tags.id) as vibes_hash_tags,COUNT(hash_tags.id)as hash_tag_count")
.group('COUNT(hash_tags.name as hash_tag_name)')
render :status => 200, :json => {:success => true, :result => { :trending_hash_tags => @tags}}
end
我想把它归为
{“成功”:真,“结果”:{“趋势散列标签”:[
{
"id": 83,
"country": "TV",
"vibes_hash_tags": 2,
"hash_tag_name": "money",
"hash_tag_count": 2
},
{
"id": 84,
"country": "TV",
"vibes_hash_tags": 3,
"hash_tag_name": "grace",
"hash_tag_count": 3
}
]
}
}
1条答案
按热度按时间ddrv8njm1#
我已经能够找到一个解决我的问题分组哈希标签.