php - 选择 MySQL 表中倒数第二个数字

标签 php mysql

在我的项目中,我想要选择提款选项或存款选项的用户的详细信息。我怎样才能做到这一点?

 SELECT *
    FROM `amount_flow`
    ORDER BY id DESC
    LIMIT 1
    WHERE detail = 'withdraw' 

Edit    Delete  25  admin   03/03/14    12000   withdraw    3500
Edit    Delete  27  hi234   03/03/14    234     withdraw    3266
Edit    Delete  29  hifft   03/03/14    213     withdraw    3053 <-
Edit    Delete  57  hisat   03/03/14    130                 2800

最佳答案

改变

SELECT *
    FROM `amount_flow`
    ORDER BY id DESC
    LIMIT 1
    WHERE detail = 'withdraw' 

SELECT *
    FROM `amount_flow`
    WHERE detail = 'withdraw' or detail = 'deposit'
ORDER BY id ASC LIMIT 1

关于php - 选择 MySQL 表中倒数第二个数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22144061/

相关文章:

php - PostGIS 函数集成在 php 示例中?

php - 在 PHP 中使用 XOR 加密/解密

php - Doctrine - 存储 ArrayCollection 键

mysql - 数据库中是否需要将域名存储为md5模式?

mysql - 将分区从第一个数据库移动到第二个数据库

php - 帮助计算 mysql 结果

PHP7 session 警告 - session_write_close

mysql - 创建 SQL View

PHP MYSQL 排序规则特殊字符 XML->PHP->MYSQL

mysql - 需要帮助连接到本地服务器上的Mysql数据库