I want to know to how many lists a user is assigned in average.
User
====
id
name
Lists_Users
===========
user_id
list_id
List
====
id
title
Is there a good way of receiving this number via SQL?
MySQLstatistics
I want to know to how many lists a user is assigned in average.
User
====
id
name
Lists_Users
===========
user_id
list_id
List
====
id
title
Is there a good way of receiving this number via SQL?
Best Answer
You only need the counts from the 2 tables and a division:
If you want more statistical information, you can write it using derived tables: