for example:
You have the users table:
userid , username, userlevel
You have banpoints table:
banpoint_id , userid , banreason, banpoint, admin_id, ban_date_time
My user id is 1.
If i select a user with an ID: 7 to add two knd of a ban point,
the banpoint table holds it in two separate rows:
banpoint_id , userid , banreason, banpoint, admin_id
1 , 7 , 'AAA' , 40 , 1
2 , 7 , 'BBB' , 50 , 1
Now select * from the users table and count all the banpoints for each users.
select users.userid ,users.username, COUNT(banpoint.banpoint) AS banp FROM users
LEFT JOIN banpoint ON banpoint.userid = users.userid
GROUP BY users.userid , users.username