我如何计算差异
我有两列数据。我需要编写一个查询,仅显示超出信用额度的客户以及超出了多少:
customer balance credit limit
418.75 500
10.75 200
200.1 100
I have data in two columns. I need to write a query that only shows the customers that have gone over their credit limit and by how much:
customer balance credit limit
418.75 500
10.75 200
200.1 100
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,这不会考虑客户信息,因为您没有提及任何客户表,但这应该可以让您获得客户余额和超额:
这非常简单;您选择余额超过限额的客户,然后只需选择差额作为第三列。
Of course this doesn't take customer information into account since you didn't mention any customer tables, but this should get you the customer balance and overage:
It's pretty straight-forward; you select customers with a balance over their limit, and just select the difference as a third column.