使用给定值计算燃料 [英] Calculation of fuel using given value
本文介绍了使用给定值计算燃料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表包含名为ME和STE的两个字段,数据类型为decimal。我想找到
(过去90天使用的ME /总计STE最后90天)* 24
并在另一个字段中显示。
我需要使用sql来解决这个问题。如何编写查询来解决这个问题。请帮我解决这个问题。
解决方案
试试:
SELECT (SUM(ME)/ SUM(STE))* 24 FROM myTable WHERE DateInserted> = DATEADD(day,-90,GetDate())
I'我会这样做:
SELECT SUM(ME) / SUM(STE)* 24 FROM myTable WHERE DateNew> = DATEADD(YourDay,-90,GetDate( ))
I have a table contains two fields named ME and STE with data type decimal.I want to find
(ME used for last 90 Days / Total STE for last 90 days) * 24
and show this in another field.
I need to solve this using sql. How can I write query for solving this. Please help me to solve this.
解决方案
Try:
SELECT (SUM(ME) / SUM(STE)) * 24 FROM myTable WHERE DateInserted >= DATEADD(day, -90, GetDate())
I''ll do it like this:
SELECT SUM(ME)/SUM(STE)*24 FROM myTable WHERE DateNew>=DATEADD(YourDay,-90,GetDate())
这篇关于使用给定值计算燃料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文