sql - How to record last 20 activity in mysql? -


i working on chatting project, found problem unable solve.

let's assume user named "randy" , have visited foo1 , foo2, bar4, teenagers,... count 30 rooms. want keep track of last 20 rooms.

i thinking create table keeping kind of record , run cron after time keeping last 2 activity, or can create row in user table store last 20 record formatting room1,room2

my question 1 better storing kind of record? or there method can solve problem more effectively?

have visit table has fk references user table (user_id) , room table (room_id) , timestamp.

of course can clean data once have more 30 rows per user_id


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -