2 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10102;
3 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10102, 4, 2, 5);
4 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10103;
5 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10103, 5, 2, 3);
7 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10113;
8 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10113, 5, 2, 5);
10 -- primary owner: discarded target
11 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10104;
12 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10104, 1, 2, 5);
14 -- secondary owners for 10101
15 DELETE FROM #PFX#usersnet WHERE owner = 10102 AND target = 10105;
16 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10102, 10105, 4, 2, 3);
17 DELETE FROM #PFX#usersnet WHERE owner = 10103 AND target = 10105;
18 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10103, 10105, 4, 3, 4);
19 DELETE FROM #PFX#usersnet WHERE owner = 10104 AND target = 10105;
20 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10104, 10105, 4, 5, 4);
21 DELETE FROM #PFX#usersnet WHERE owner = 10113 AND target = 10105;
22 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10113, 10105, 4, 2, 5);
24 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10107;
25 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10107, 3, 3, 4);
27 -- check sit permission
29 DELETE FROM #PFX#usersnet WHERE owner = 10102 AND target = 10109;
30 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10102, 10109, 4, 2, 3);
31 DELETE FROM #PFX#usersnet WHERE owner = 10103 AND target = 10109;
32 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10103, 10109, 4, 2, 3);
35 DELETE FROM #PFX#usersnet WHERE owner = 10102 AND target = 10110;
36 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10102, 10110, 4, 2, 3);
37 DELETE FROM #PFX#usersnet WHERE owner = 10103 AND target = 10110;
38 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10103, 10110, 1, 2, 3);
41 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10111;
42 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10111, 1, 2, 3);
43 DELETE FROM #PFX#usersnet WHERE owner = 10102 AND target = 10111;
44 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10102, 10111, 4, 2, 3);
45 DELETE FROM #PFX#usersnet WHERE owner = 10103 AND target = 10111;
46 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10103, 10111, 4, 2, 3);
49 DELETE FROM #PFX#usersnet WHERE owner = 10101 AND target = 10112;
50 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10101, 10112, 4, 2, 3);
51 DELETE FROM #PFX#usersnet WHERE owner = 10102 AND target = 10112;
52 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10102, 10112, 4, 2, 3);
53 DELETE FROM #PFX#usersnet WHERE owner = 10103 AND target = 10112;
54 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10103, 10112, 1, 2, 3);
57 DELETE FROM #PFX#usersnet WHERE owner = 10103 AND target = 10115;
58 INSERT INTO #PFX#usersnet (owner, target, friend, skill, trust) VALUES (10103, 10115, 1, 0, 0);
60 SELECT * FROM #PFX#usersnet WHERE owner = 10101 OR owner IN (10102, 10103, 10113) ORDER BY target;
62 SELECT * FROM #PFX#usersnet_wideskill ORDER BY owner, target;
64 SELECT * FROM #PFX#usersnet_narrowskill ORDER BY owner, target;
66 SELECT owner, target, skill, 1 AS count, us.login as login FROM #PFX#usersnet, #PFX#users as us WHERE owner = 10101 AND us.code = target AND friend > 2 ORDER BY target;
68 SELECT ns.*, us.login AS login FROM #PFX#usersnet_narrowskill as ns, #PFX#users AS us WHERE owner = 10101
69 AND ns.target NOT IN (SELECT target FROM #PFX#usersnet WHERE owner = 10101)
70 AND us.code = ns.target UNION SELECT owner, target, skill, 1 AS count
72 , us.login as login FROM #PFX#usersnet, #PFX#users as us WHERE owner = 10101 AND us.code = target AND friend > 2 ORDER BY target;
74 SELECT us.login, pa.* FROM #PFX#usersnet_party pa, #PFX#users as us WHERE pa.target = us.code AND pa.owner = 10101;
76 SELECT * FROM #PFX#usersnet_widefriend ORDER BY owner, target, friend;
77 SELECT * FROM #PFX#usersnet_narrowfriend ORDER BY owner, target, friend;