sql - Interview: how to get last clicked option at the top across all sessions for a particular user in C# asp.net? -


suppose have 4 options like

option1 option2  option3  option4 

if user clicks on option4 sequence should this:

option4  option1 option2  option3 

where option4 @ top. when user clicks option2 sequence should like:

option2  option4  option1 option3 

where option2 @ top. system should maintain option sequence users according last option selected.

even if insert last selected record in database how record in same sequence? if order serial number there can case user can click on option4 10 times insert option4 10 times in database. how track last selected option when particular user logs on system?

how achieve across every user session? when user logs on should last selected option in system.

when store data/log this:

user | option | datetime -----+--------+---------------------- 1    | 4      | 2015-04-25 10:50:01 1    | 3      | 2015-04-25 10:50:02 2    | 4      | 2015-04-25 10:50:02 1    | 2      | 2015-04-25 10:50:03 .... 

in table can 4 last/recent options this:

select top(4) [option] [log] [user] = 1 order [datetime] desc 

if want ignore repeated logs 1 option need group by keyword this:

select top(4) [option] [log] [user] = 1 group [option] order max([datetime]) desc 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -