sql - Can you tell me a better approach in designing a table for banned users than this? -


i designing web application , need give administrators , moderators right allow , deny other users access application. thinking of having table following columns:

  1. operationtype (ban / access regained).
  2. banneduser
  3. user (admin/mod gave access or banned user)
  4. eventdate
  5. reason (optional)

i can have table, storing banned users, want keep track of happening in app , make sure administrators , moderators not misbehaving well.

so, if table doesn't include operationtype column, list of banned users retrieved simple writing following query:

select banneduser userban; 

but if leave table operationtype column, shown above, simple select query become this:

select o3.banneduser  ( select o1.banneduser, max(o1.eventdate) eventdate userban o1 group o1.banneduser ) o2, userban o3  o3.eventdate = o2.eventdate , o3.banneduser = o2.banneduser , o3.operationtype = 1 

assume operationtype = 1 ban.

so, can give me better solution case? :)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -