Column not found: 1054 Unknown column 'COUNT(gift_sents.receiver_id' in 'field list' (SQL: selectusers.*,COUNT(gift_sents.receiver_idastotal_postsfromusersinner joingift_sentsongift_sents.receiver_id=users.idgroup bygift_sents.idorder bytotal_postsasc limit 3)推荐答案而不是:->select('users.*', 'COUNT(gift_sents.receiver_id as total_posts')您应该使用:->selectRaw('users.*, COUNT(gift_sents.receiver_id) as total_posts') 这篇关于Laravel:如何计算查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 19:41