如何使用“order by”和“where”相同的时间

时间:2013-11-01 10:55:11

标签: mysql sql-order-by

如何将order by 'id' DESC添加到此代码中?

$querya = mysql_query("select * FROM  {$table_prefix}  where act='1' and status='0' LIMIT  $start_at,$entries_per_page" );

3 个答案:

答案 0 :(得分:2)

尝试这样做。使用id(反向引号)

$querya = mysql_query("select * FROM {$table_prefix} where act='1' and status='0' 
order by `id`
LIMIT $start_at,$entries_per_page" );

答案 1 :(得分:1)

它看起来只是一个真正的问题......我认为,答案就是这个。

$querya = mysql_query("select * FROM {$table_prefix} where act='1' and status='0' ORDER BY 'id' DESC LIMIT $start_at,$entries_per_page" );

答案 2 :(得分:0)

试试这个

$querya = mysql_query("select * FROM {$table_prefix} where act='1' and status='0' ORDER BY 'id' DESC LIMIT $start_at,$entries_per_page" );