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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:25:01+00:00 2026-05-25T10:25:01+00:00

When I run the below query: select SUM(t1.total_amount) as one, SUM(t2.total_amount) as two from

  • 0

When I run the below query:

select SUM(t1.total_amount) as one, SUM(t2.total_amount) as two
from table1 t1, table2 t2;

I get these results:

ONE     TWO
2000    3000

But when I run this query:

select SUM(t1.total_amount) as one table1 t1;

I get this result:

ONE
50

It looks like the result from the first query is incorrect. Can anybody point me to the right direction?

  • 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-25T10:25:02+00:00Added an answer on May 25, 2026 at 10:25 am

    When doing this:

    select * from table1 t1, table2 t2
    

    you’re actually cross joining both tables, resulting in a cartesian product (every row in t1 is combined with every row in t2).

    You’re probably missing a JOIN condition:

    select sum(t1.total_amount), sum(t2.total_amount)
    from t1 join t2 on t1.[???] = t2.[???]
    

    EDIT:

    based on your comment, it looks like you want a union of these two separate queries
    select ‘t1’, sum(total_amount) from t1
    union
    select ‘t2’, sum(total_amount) from t2

    This will show the sums in two rows instead of columns, but it’s the easiest way AFAIK.

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

Sidebar

Related Questions

When I run the below SQL 08 query I get an error that tbrm_Article.ArticleID
I have a reusable select query method called by two other methods. These are
I have below SQL query: SELECT * FROM ( SELECT S.aCol, S.bCol, S.cCol, ROW_NUMBER()
I have this query below: SELECT a.id, b.item_name FROM table_1 as a INNER JOIN
I need a regex to run against strings like the one below that will
When I run the query below I keep getting the values twice. The array
i am useing the query below, when i run this query once per page
I am using the below query to run an sql statement. It works fine.
I use the query Select t1.name as first, t2.name as second From products t1,
I have a SELECT statement (see below) that gets a few items from the

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.