尝试设置数量范围,例如0到9 10到19 ... 50-99,但是单独进行设置时,即a.Amount> 50返回数据行,类似地a.Amount> 100返回数据行,但随后返回空行。请帮助截止日期临近!金额是varchar数据类型。

SELECT   DATE_FORMAT((STR_TO_DATE(a.TRANSACTION_DATE,'%d.%m.%Y')), '%Y%m') mnt,
         COUNT(DISTINCT a.CUSTOMER_ID) totalNum
FROM    credittx a
WHERE   a.COUNTRY = 'Germany'
        AND a.AMOUNT   BETWEEN   100 AND 50
GROUP   BY DATE_FORMAT((STR_TO_DATE(a.TRANSACTION_DATE,'%d.%m.%Y')),'%Y%m')

最佳答案

范围是从到

BETWEEN 50 AND 100

关于mysql - Between子句不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20215424/

10-09 18:53