I Feld angeben berechnen Verhältnis will, muss ich in Legacy-SQL weiß ich RATIO_TO_REPORT Funktion ex verwenden können:BigQuery RATIO_TO_REPORT für alle Daten keine Partition
SELECT
month,
RATIO_TO_REPORT(totalPoint) over (partition by month)
FROM (
SELECT
format_datetime('%Y-%m', ts) AS month,
SUM(point) AS totalPoint
FROM
`userPurchase`
GROUP BY
month
ORDER BY
month)
aber ich möchte Verhältnis erhalten, die von allen Daten ohne Partition zu berechnen, ex: (Dieser Code funktioniert nicht)
SELECT
month,
RATIO_TO_REPORT(totalPoint) over (partition by "all"),
# RATIO_TO_REPORT(totalPoint) over (partition by null)
FROM (
SELECT
format_datetime('%Y-%m', ts) AS month,
SUM(point) AS totalPoint
FROM
`userPurchase`
GROUP BY
month
ORDER BY
month)
Es funktioniert nicht, Wie kann ich für das gleiche tun? Vielen Dank!
Mögliche Duplikat nur [wie RATIO \ _TO \ _REPORT() in Standard-SQL in BigQuery zu implementieren?] (Https: // Stackoverflow .com/questions/40878410/how-to-implementation-ratio-to-report-im-standard-sql-in-bigquery) –
Schließen Sie einfach nicht den 'PARTITION BY' Teil ein. Für die Funktion selbst, siehe https://stackoverflow.com/q/40878410/6253347 –