0
$query = mysql_query('SELECT * FROM submissions ORDER BY (votes * id) DESC');

This gives me an error. Is there any way to do this?

4

3 回答 3

1

我邀请您按投票数和 ID 获取提交顺序列表。
你可以使用这样的代码:

$query = mysql_query('SELECT * FROM submissions ORDER BY votes DESC, id DESC');
于 2011-03-06T03:47:14.913 回答
1
SELECT *, (votes * id) AS x FROM submissions ORDER BY x DESC

你会多写一列,但我想我会工作=|

于 2011-03-06T03:32:38.193 回答
0

只要类型正确,您提供的 SQL 就有效。至少在 Postgres 中。你用的是什么数据库?

于 2011-03-06T03:47:10.850 回答