Public feed #727260

Someone

public text v1 · immutable
Raw Edit
·published 2007-10-05 21:47 UTC
rendered paste body
mysql> DESCRIBE UserStats;
+-------------+------------------+------+-----+------------+-------+
| Field       | Type             | Null | Key | Default    | Extra |
+-------------+------------------+------+-----+------------+-------+
| UserID      | int(11)          | NO   | PRI |            |       |
| Week        | date             | NO   | PRI | 0000-00-00 |       |
| Submissions | int(11)          | NO   |     | 0          |       |
| Corrections | int(11)          | NO   |     | 0          |       |
| Comments    | int(11) unsigned | NO   |     |            |       |
| Genres      | int(11)          | NO   |     | 0          |       |
+-------------+------------------+------+-----+------------+-------+

mysql> SELECT ((SUM(`Submissions`)*5)+(SUM(`Corrections`)*3)+SUM(`Comments`)) AS Score, u.Name FROM UserStats s
INNER JOIN LUM_User u ON u.UserID=s.UserID GROUP BY s.UserID ORDER BY ((SUM(`Submissions`)*5)+(SUM(`Corrections`)*3)+SUM(`Comments`)) DESC LIMIT 10;

+-------+-----------------+
| Score | Name            |
+-------+-----------------+
|     0 | Katherine       |
|     0 | guayamapr       |
|     0 | kareed          |
|     0 | kantahan101     |
|     0 | exclusivespirit |
|     0 | thevoice11      |
|     0 | tiela's songs   |
|     0 | vampaka         |
|     0 | chirock         |
|     0 | Miracles        |
+-------+-----------------+
10 rows in set (0.22 sec)

mysql> SELECT ((SUM(`Submissions`)*5)+(SUM(`Corrections`)*3)+SUM(`Comments`)) AS Score, u.Name FROM UserStats s INNER JOIN LUM_User u ON u.UserID=s.UserID WHERE s.UserID=8335 GROUP BY s.UserID;
+-------+--------+
| Score | Name   |
+-------+--------+
|  1405 | awayla |
+-------+--------+
1 row in set (0.00 sec)