需要一个案例声明 [英] Need a case Statement

查看:95
本文介绍了需要一个案例声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All 

Hello All 

我有一个计算,它运行良好。但问题是我们选择4月1日到4月22日的日期,我只获得前6天的数据。

I have a calculation, where it runs good. But the thing is that hen we select dates from 1st of April to 22nd April, I am only getting first 6 days data.

(原因是我们7日没有数据,所以我需要以下计算的案例陈述)

( the reason is we have no data on 7th, So I need a case statement for this calculation below)

SELECT  CAST( (((SUM(@AB)/(SUM(@ BC) )) - (SUM(@CA)
/(SUM(@BC))))


/(SUM(@CA)/(SUM(@BC))))* 100  AS
DECIMAL(19,2))

谢谢,

Suresh

推荐答案

Hi
Suresh,

 

根据您的描述,'从4月1日到4月22日选择日期'意味着您希望获得22行数据。对吗?

Per your description, ' select dates from 1st of April to 22nd April' means that you would like to get 22 rows data . Right ?

 

上面脚本的结果是什么?你的意思是当日期不存在时会显示结果吗?

And what is the result of your above script ? Did you mean that when the date is not existed the result will be shown ?

 

你能 
请分享我们您的表结构和一些示例数据 (CREATE TABLE AND INSERT INTO的脚本) 以及您的预期结果
这样我们就可以获得正确的方向并进行一些测试。请参考
POSTING
提示 - 代码,图像,超链接,详细信息

 

最好的问候,

Rachel


这篇关于需要一个案例声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆