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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:02:32+00:00 2026-06-16T07:02:32+00:00

I have 2 tables in my sqlite3 database. Can someone help me with the

  • 0

I have 2 tables in my sqlite3 database. Can someone help me with the sql command below:

tbltrans:

transid |  transdate | discountpercentage | Bank
12345     10/09/2011     5                  20.00

tbltrans2:

transid   |   itemnr   |price | btwpercentage | qty
12345         205        10.11        12        5
12345         302        15.00        6         7
12345         501        20.00        21        3

SO I want to get a query table with total amount of sale for each transid’s and calculated cash column, Like:

Select
Sum(tbltrans2.qty * tbltrans2.price) as TotalAmount,
(Totalamount - tbltrans.Bank) as Cash
where 
tbltrans.transid = tbltrans2.transid and transdate = '10/09/12'

Can someone please correct this sql satement ?

  • 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-16T07:02:33+00:00Added an answer on June 16, 2026 at 7:02 am
    Select
    Sum(ifnull((tbltrans2.qty * tbltrans2.price),0))-tbltrans.Bank as cash
    from tbltrans,tbltrans2
    where 
    tbltrans.transid = tbltrans2.transid and tbltrans.transdate = '10/09/12'
    group by tbltrans.transid 
    

    try this

    If you want to select total amount also then include this in
    select,

    Sum(ifnull((tbltrans2.qty * tbltrans2.price),0)) as TotalAmount
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 tables in my sqlite3 database. Can someone help me with the
i have a sqlite3 database that has multiple (six) tables and i need it
I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation
In this example we have 3 related tables on a SQLite database: CREATE TABLE
I have an SQLite database. I created the tables and filled them with a
So this is what I have, I have a SQLite database with 3 tables:
I have used SQLIte3 to create databases and then added tables to it. Then
I have this releases table in a SQLite3 database, listing each released version of
Let's say I have 2 tables, Contacts and Phones . User can input name
Again, I need someone's help. I am following the below tutorial for SQLite connection

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.