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

  • Home
  • SEARCH
  • 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 3214134
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:01:29+00:00 2026-05-17T15:01:29+00:00

i have a table with 3 columns and i need to get the sum

  • 0

i have a table with 3 columns and i need to get the sum of the values in the second coloumn I am keeping an ID which is used to identify cells of addition. I need to do it in J query ?I would like to know how I can able to acess each rows and colums of a table using for loop.

<table>
    <tr>
        <td>ID</td>
        <td>Mark</td>
    <tr>
        <td>1</td>
        <td>40</td>
    </tr>
    <tr>
        <td>2</td>
        <td>35</td>
    </tr>
    <tr>
        <td>1</td>
        <td>52</td>
    </tr>
</table>

Can I able to access each rows using some indexes like #tbl[row][col] etc .Thnaks In Advance
I NEED TO ADD THE VALUES WHERE ID WILL BE ONE THAT IS EXPECTED OUTPUT IS 92[40+52]

  • 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-05-17T15:01:30+00:00Added an answer on May 17, 2026 at 3:01 pm

    Something like this would work:

    ​function getTotal(id) {
      var total = 0;
      $("td:first-child").filter(function() { return this.innerHTML == id; })
          .next().each(function() { total += parseInt(this.innerHTML, 10); });
      return total;           
    }
    

    For example:

    alert(getTotal(1)); // alerts 92
    alert(getTotal(2)); // alerts 35
    

    You can test it out here., what this does is get the first columns of cells, does a .filter() down to those that match the ID (don’t use :contains() here, it’s a substring match) then for the matches, get the neighboring cell using .next(). For those cells we’re just using praseInt() to get the number and add it to the total.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a table which has three columns in it: Customer_name, Age_range, Number_of_people. 1
I have table in MySQL database with two integer columns for example: userid |
I have two columns syntax and query in my table Table1 . Syntax contains
I have the following Execution statement which creates a table (using data from another
I want to join three tables and to calculate the Sum(Quantity) of the Table
I have a HTML table base invoice for collecting the details of a order.
I have this table: id | owner | asset | rate ------------------------- 1 |
I need to be able to process an input file where there are 3
Let's says I have a set of tables that match the following scenario: Crates
Not sure how to describe what I'm trying to get from this question, but

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.