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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:19:24+00:00 2026-05-29T18:19:24+00:00

I have 2 tables like id att1 att2 1 34 56 2 45 12

  • 0

I have 2 tables like

id  att1 att2
1   34    56
2   45    12
3   34    11


id  att1 att2
1   14    10
2   25    2
3   14    10

How to get the diference between the 3 values like

id      att1      att2
1-1=0  34-14=20  56-10=46
2-2=0  45-25=20  12-2 =10  
3-3=0  34-14=20  11-10=1 


SELECT A.id-B.id, A.att1-B.att1,A.att2-B.att2 from TABLEA as A join TABLEB as B...
  • 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-29T18:19:25+00:00Added an answer on May 29, 2026 at 6:19 pm

    Not sure what you’re looking for that you didn’t already supply in your question. Did you mean something like this?

    SELECT
        CAST(A.id AS VARCHAR(200)) + '-' +  CAST(B.id AS VARCHAR(200)) + '=' + CAST(A.id - B.id AS VARCHAR(200)) id
        ,CAST(A.att1 AS VARCHAR(200)) + '-' +  CAST(B.att1 AS VARCHAR(200)) + '=' + CAST(A.att1 - B.att1 AS VARCHAR(200)) att1
        ,CAST(A.att2 AS VARCHAR(200)) + '-' +  CAST(B.att2 AS VARCHAR(200)) + '=' + CAST(A.att2 - B.att2 AS VARCHAR(200)) att2
    FROM
        TABLEA A
        INNER JOIN TABLEB B ON A.id = B.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tables like this: from sqlalchemy import Column, Integer, select from sqlalchemy.ext.declarative import
I have two tables like below, mysql> select * from Books ; +----+------+------------+----------+----------+ |
I have tables like Person{id, name, dob} employee{id, company_name, joining_date}. I need to join
I have a table like att1 att2 att3 att4 ------------------- 1 6 11 16
I have tables like these two test_table date student test 2012-05-31 Alice Math 2012-05-31
I have tables like this: tblUsers int UserID string UserName tblUsersInRoles int UserID int
hi i have tables like this: Persons: person_id, name then i have many langauge
I have two tables like so; id_image foo bar 1 3 5 2 8
I have two tables like, CREATE TABLE [dbo].[entry] ( [id] [int] NULL, [service] [int]
I have 2 tables like this: Stock Table product_id bigint(20) qty float Sales Table

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.