php - ORDER BY 在 php 的连接中无法正常工作

标签 php mysql

我试图在我的数据表中首先显示最后一条记录..所以我在查询末尾使用了ORDER BY..但它无法正常工作。

这是我的查询

 $retval = "SELECT clientid,client_name,firstname,created_on 
            FROM `mdl_moog_clients`  
            JOIN mdl_user 
              ON mdl_moog_clients.created_by=mdl_user.id 
            where deletestatus='1' 
              and clientid!='1' 
            ORDER BY clientid DESC";

这里clientid是主键

谁能帮帮我..哪里出了问题..

提前致谢..

最佳答案

并且在 orderby 之前放错了位置

$retval = "SELECT clientid,client_name,firstname,created_on 
        FROM `mdl_moog_clients`  
        JOIN mdl_user 
          ON mdl_moog_clients.created_by=mdl_user.id 
        where deletestatus='1' 
          and clientid !='1'  
        ORDER BY clientid DESC";

关于php - ORDER BY 在 php 的连接中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46338562/

相关文章:

php - 按钮点击多个动态下拉提交到mysql表

php - 我如何使用 codeigniter 在 php 中执行权限?

php - 在 Zend Framework 1.10.x 中使用 Doctrine 2

php - 购物车数据库设计: adding functionality for quantities by size

php - 如何将一列中的值分成两列作为表格

php - 如何防止跨站脚本

PHP 只允许 img 标签

mysql - 如何在 MS SQL Server Management 2005 中将列信息合并为一行

mysql - 如何获得sql中某个值的胜率?

Python - MySQL 连接错误