问题
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
回答1:
I saw you other post. Not 100% sure what you are trying to do, but you might want to consider using a windows function like ratio_to_report. See the example below. Here is a link to the windows functions
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 |
+----------+--------+----------------+
来源:https://stackoverflow.com/questions/59218213/how-to-use-the-percent-key-word-in-the-snowflake-query