Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
82250683
Commit
82250683
authored
Feb 10, 2010
by
Richard Mansfield
Browse files
Add query to get the user with the most friends
Signed-off-by:
Richard Mansfield
<
richardm@catalyst.net.nz
>
parent
05f0449e
Changes
1
Show whitespace changes
Inline
Side-by-side
htdocs/lib/registration.php
View file @
82250683
...
...
@@ -258,6 +258,20 @@ function user_statistics($limit, $offset) {
get_string
(
'Total'
),
);
$data
[
'table'
]
=
user_stats_table
(
$limit
,
$offset
);
$maxfriends
=
get_records_sql_array
(
"
SELECT u.id, SUM(f.friends) AS friends
FROM
{
usr
}
u INNER JOIN (
SELECT DISTINCT(usr1) AS id, COUNT(usr1) AS friends
FROM
{
usr_friend
}
GROUP BY usr1
UNION SELECT DISTINCT(usr2) AS id, COUNT(usr2) AS friends
FROM
{
usr_friend
}
GROUP BY usr2
) f ON u.id = f.id
GROUP BY u.id
ORDER BY friends DESC
LIMIT 1"
);
$data
[
'maxfriends'
]
=
$maxfriends
[
0
];
return
$data
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment