-2
SELECT  NBR, Customers, status
FROM (
  SELECT  NBR, Customers, Code AS status
  FROM   CCC AS CS 
  INNER JOIN AAA AS AC ON CCC.B2= ACT.B1 AND CSS.B2 = ACT.B1
) AS rst
WHERE status IN ('A', 'T')
ORDER BY NBR LIMIT 100 PERCENT
4

1 回答 1

0

我看到你的另一个帖子。不能 100% 确定您要做什么,但您可能需要考虑使用诸如 ratio_to_report 之类的 Windows 函数。请参见下面的示例。这是windows函数的链接

https://docs.snowflake.net/manuals/sql-reference/functions-analytic.html

select 
        store_id, profit, 
        100 * ratio_to_report(profit) over () as percent_profit
    from store_profit
    order by store_id;
+----------+--------+----------------+
| STORE_ID | PROFIT | PERCENT_PROFIT |
|----------+--------+----------------|
|        1 | 300.00 |    30.00000000 |
|        2 | 250.00 |    25.00000000 |
|        3 | 450.00 |    45.00000000 |
|        4 |   NULL |           NULL |
+----------+--------+----------------+

于 2019-12-06T18:47:52.140 回答