Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUM function #61

Open
iankressin opened this issue Nov 28, 2024 · 0 comments
Open

SUM function #61

iankressin opened this issue Nov 28, 2024 · 0 comments
Labels
enhancement New feature or request eql-core

Comments

@iankressin
Copy link
Owner

Description

The SUM function must reduce all column values to a single value by adding the values together.

Syntax

SUM accepts a query as parameter, and all the fields specified in that query must be numeric.

Definition:

query = GET <[fields, ]> FROM <entity> <[entity_id, ]> ON <chain>
SUM(<query>)

Examples:

# ACCOUNTS

# ✅ Valid query
SUM(GET balance FROM account vitalik.eth ON eth, base, arb)

# ❌ Invalid query: cannot sum addresses
SUM(GET balance, address FROM account vitalik.eth ON eth, base, arb)

# TRANSACTIONS

# ✅ Valid query
SUM(GET value FROM tx WHERE block = latest ON eth, base, arb)

# ❌ Invalid query: cannot sum hashes
SUM(GET value, hash FROM tx WHERE block = latest ON eth, base, arb)
@iankressin iankressin added enhancement New feature or request eql-core labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request eql-core
Projects
None yet
Development

No branches or pull requests

1 participant