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 8495115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:28:52+00:00 2026-06-10T23:28:52+00:00

I am using SQLite and am trying to return the total of one column

  • 0

I am using SQLite and am trying to return the total of one column buy_price in the column TOTAL while at the same time returning all of the data. I do not want/need to group the data as I need to have the data in each returned row.

id    date       pool_name    pool_id    buy_price  TOTAL
 1    09/01/12   azp          5          20
 2    09/02/12   mmp          6          10
 3    09/03/12   pbp          4          5
 4    09/04/12   azp          7          20
 5    09/05/12   nyp          8          5             60

When I include something like SUM(buy_price) as TOTAL it only returns one row. I need all rows returned along with the total of all buy_price entries.

  • 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-10T23:28:54+00:00Added an answer on June 10, 2026 at 11:28 pm

    It sounds like this is what you are looking for:

    select id,
      dt,
      pool_name,
      pool_id,
      buy_price,
      (select sum(buy_price) from yourtable) total
    from yourtable
    

    see SQL Fiddle with Demo

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

Sidebar

Related Questions

I'm trying to insert data into the SQLite database using get EditText, but I
I am trying to retrieve data using query from the sqlite database that was
I've been using SQLite for Windows Phone ( http://wp7sqlite.codeplex.com/ ) trying to do a
I am new to using SQLite databases and android mobile development. I am trying
I am using SQLite in an application that I am developing. I am trying
I started by trying to store strings in sqlite using python, and got the
I'm trying to make some utils for using with sqlite databases. For that I
I am trying to learn sqlite for the iphone and am using the tutorial
I am trying to add a sqlite DB into an application using this: CoreData:
I am trying to access an SQLite 3 database programmatically using the code below:

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.