总订单取消订单的%

发布于 2025-02-03 04:38:23 字数 321 浏览 3 评论 0原文

当我计算出子查询中的total_orders和cancelled_orders时,我需要帮助衍生新列“ concellation_percentage”。

我正在尝试以下代码,但投掷错误。你能帮忙吗?

select cancelled_orders,total_orders,cancelled_percentage
CEILING (CAST(cancelled_orders As FLOAT)/CAST(SUM(total_orders) OVER() AS FLOAT)*100)) as cancelled_percentage
from orders;

I need help in deriving new column 'cancellation_percentage' when I have calculated total_orders and cancelled_orders in sub queries.

I am trying below code but its throwing error. Could you please help ?

select cancelled_orders,total_orders,cancelled_percentage
CEILING (CAST(cancelled_orders As FLOAT)/CAST(SUM(total_orders) OVER() AS FLOAT)*100)) as cancelled_percentage
from orders;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心病无药医 2025-02-10 04:38:23

缺失,在第一次取消cancelled_percentage(NB输出2列相同名称?),天花板和(许多)之间的空间

select cancelled_orders,total_orders,cancelled_percentage,
CEILING(CAST(cancelled_orders As FLOAT)/CAST(SUM(total_orders) OVER() AS FLOAT)*100) as cancelled_percentage
from orders; 

Missing , after first cancelled_percentage (nb output 2 columns same name?), space between ceiling and ( to many )

select cancelled_orders,total_orders,cancelled_percentage,
CEILING(CAST(cancelled_orders As FLOAT)/CAST(SUM(total_orders) OVER() AS FLOAT)*100) as cancelled_percentage
from orders; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文