mysqli - sql - displaying count of user id per count of answer -


i have table containing answer data answered unique user. have query.

select ta.user_id, count(ta.answer_id) count_answer_id  survey_answers ta  group ta.user_id  having count(ta.answer_id) < 124 order count_answer_id desc;    userid  count of answers 3702    123 2866    120 5483    120 565     120 1292    120 621     119 2250    119 2719    119 4192    119 5539    119 354     119 1441    119 2501    115 1636    115 866     109 53      108 3091    107 329     106 285     105 997     104 1352    103 5281    103 430     102 2125    102 

but results this.

user count    answer count 1               123 4               120 7               119 2               115 . . . . 

select count(*) user_count, count_answer_id  (   select ta.user_id, count(ta.answer_id) count_answer_id    survey_answers ta    group ta.user_id    having count(ta.answer_id) < 124  ) tmp group count_answer_id  order count_answer_id desc 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -