i trying to get all likes against an answer. this is what i have come with soo far. but now i don't know what should i do.
return DB::table('answers')
->join('member','answers.answer_member_fk','=','member.member_id')
->select('answers.*','member.full_name','member.user_name','member.profile_photo',DB::raw('count(ans_likes.ans_like_id) as total_likes '))
->leftjoin('ans_likes','answers.answer_id','=','ans_likes.ans_like_answer_fk')
->where('answers.answer_question_fk','=',$question_id)
->groupBy('answers.answer_id')
->get();
it is giving me Syntax error or access violation: 1055
error according to this error i have to add all the selected columns to groupby. which i think is not a good idea to do so. kindly guide me.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DX7uzX
via IFTTT
Aucun commentaire:
Enregistrer un commentaire