userkey keyboardkey keypressed
----------------------------------------
u1 kb1 A
u1 kb1 B
u1 kb2 C
u2 kb1 A
u2 kb1 B
u3 kb1 A
u3 kb1 B
u3 kb1 D
u4 kb1 E
How can i write a linq to sql query to get only the common keypressed.
For instance find the common keypressed where user account is in (u1, u2, u3) and keyboardkey = kb1. This will give the output as alist containing A,B.
And find the common keypressed where user account is in (u1, u2, u3, u4) and keyboardkey = kb1 then it should return nothing.
Thanks.
Something like this should work:
This requires:
keysto be the SQL table in questionuserKeyListto be an array of user accounts, i.e. a string array – in your example(u1, u2, u3)someKeyboardkeyto be some keyboard key value, in your examplekb1.userCountthe number of users in theuserKeyListarray (userKeyList.Length)