选择我的MySQL表中的倒数第二个数字

时间:2014-03-03 10:20:12

标签: 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

1 个答案:

答案 0 :(得分:1)

更改

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