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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:57:16+00:00 2026-05-21T06:57:16+00:00

i have been having for SQL trouble, i am using an SQLite database and

  • 0

i have been having for SQL trouble, i am using an SQLite database and can sadly not get the following to work. All help is appreciated.

I want the following query to sum all integers in the amount column of transactionTable fitting the criteria. One of the criteria changes from row to row in the outer query, so i want the inner query to run one time for every row in the outer query.

i get the following error when running this query: “no such column: ct.name”
i have bolded the line that i think is wrong in the query below.

table 1 : categoryTable

columns: id, icon, name, starred

table 2 : transactionTable

columns: id, date, amount, sign, category

query:

SELECT id, icon, name, starred, mySum 
    FROM categoryTable ct, 
         (SELECT sum(amount) AS mySum FROM transactionTable 
          WHERE date<'1992' AND date>'1990' 
          AND sign = '-' AND category=ct.name) AS sumTable 
    WHERE mySum!=0 
    ORDER BY mySum DESC

Thanks!

  • 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-21T06:57:16+00:00Added an answer on May 21, 2026 at 6:57 am

    I think this can be done without the subquery. Try this version.

    SELECT ct.id, ct.icon, ct.name, ct.starred, SUM(tt.amount) AS transactionSum 
        FROM categoryTable ct
            INNER JOIN transactionTable tt
                ON ct.name = tt.category
                    AND tt.date < '1992' 
                    AND tt.date > '1990'
                    AND tt.sign = '-'
        GROUP BY ct.id, ct.icon, ct.name, ct.starred
        HAVING SUM(tt.amount) != 0
        ORDER BY transactionSum DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I having trouble in dividing the HTML frames. I have been using the following
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
i ave been having trouble with a simple select sql query. using php PDO.
I have been having trouble with timeout on SQL program , I have narrowed
I have been having some problems trying to get my PHP running. When I
I have been working with Microsoft SQL Server since 6.5 along with other database
It's been a while since I used SQL, and I'm having trouble coming up
i have been having this trouble when trying to obtain json data. lets say
I have been having trouble deploying liferay portlets and themes from the command line
This is a really weird problem that I have been having. When I download

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.