Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:12:40+00:00 2026-06-15T13:12:40+00:00

How can we get the sum of column entries in the NO-SQL database Redis?

  • 0

How can we get the sum of column entries in the NO-SQL database Redis?

I mean similar as :

    Select sum(salary) from Account;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:12:40+00:00Added an answer on June 15, 2026 at 1:12 pm

    The short answer is, you can’t. That’s not quite what redis was meant for.
    The somewhat longer answer is, you can accomplish this with redis lua scripting, and the EVAL command.

    With a redis list such as:

    LPUSH mylist 1 2 3 4 5 6 7
    

    And a script sum.lua:

    local list = redis.call('lrange', KEYS[1], 0, -1)
    local sum = 0
    for i, val in ipairs(list) do
      sum = sum + val
    end
    
    return sum
    

    You could call it from the command line, like this:

    $ redis-cli EVAL "$(cat sum.lua)" 1 mylist
    (integer) 28
    

    Edit: The third answer is @DidierSpezia’s comment, about calculating it when permuting the data. Usually when working with redis, you will structure your data according to how you want to query it, rather than the other way around. Perhaps you would do something like:

    # Paying out salary
    redis> LPUSH employee:17:salaries 10000
    redis> HINCRBY total_salaries 17 10000
    
    # Fetching total salary to employee 17
    
    redis> HGET total_salaries 17
    "10000"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can I assign a column name to the SUM column ? i.e. select
I would like to get a sum from a column, with and without a
How can I get the sum of the column price for a specific month.
How can I get a sum for the column pieces in a datatable? Say
I have the following query: SELECT CONVERT(DECIMAL(11,1),SUM(Column/1000*-1)) AS NAME, FROM Table The reason i
SELECT EmployeeMaster.EmpNo, Sum(LeaveApplications.LeaveDaysTaken) AS LeaveDays FROM EmployeeMaster FULL OUTER JOIN LeaveApplications ON EmployeeMaster.id =
I have this query: SELECT p.text,se.name,s.sub_name,SUM((p.volume / (SELECT SUM(p.volume) FROM phrase p WHERE p.volume
I have figured out that I can use hibernate to get the sum of
I have a column of data returned from my database and I'd like to
Can someone tell me why this isn't working? I'd like to get the sum

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.