Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL查找停止消费的客户_Sql - Fatal编程技术网

SQL查找停止消费的客户

SQL查找停止消费的客户,sql,Sql,我有一个问题我正试图解决基于: 每月客户订阅付款的12个月数据(6月17日至5月17日) 4月17日价格上涨 我已经确定了那些在3月17日之前每月付款的客户,但我现在如何才能找到这些客户中哪些从4月17日起不再付款 任何伪代码都会大有帮助 谢谢你想要这样的东西: select customerId from t group by customerId having max(dte) >= '2017-03-01' and max(dte) < '2017-04-01';

我有一个问题我正试图解决基于:

每月客户订阅付款的12个月数据(6月17日至5月17日)

4月17日价格上涨

我已经确定了那些在3月17日之前每月付款的客户,但我现在如何才能找到这些客户中哪些从4月17日起不再付款

任何伪代码都会大有帮助
谢谢你想要这样的东西:

select customerId
from t
group by customerId
having max(dte) >= '2017-03-01' and
       max(dte) < '2017-04-01';
选择customerId
从t
按客户ID分组
最大(dte)>='2017-03-01'和
max(dte)<'2017-04-01';

任何伪代码都会有很大帮助
。。。我只是想问你这个问题,样本数据也很好。