473,569 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

computations when doing a join

I have two tables with the same structure and need to compare the
similar rows where they exist. That's the easy part. However, I can't
figure out a way to do a calculation when a specific row only exists
in one of the tables.

Ex:
Table A
--------------
| id | value |
--------------
| 1 | 10 |
| 2 | 20 |
--------------

Table B
--------------
| id | value |
--------------
| 2 | 25 |
| 3 | 35 |
--------------

I'd like the result to reflect the sum of the values
--------------
| id | value |
--------------
| 1 | 10 |
| 2 | 45 |
| 3 | 65 |
--------------

But what I get when doing a join is
--------------
| id | value |
--------------
| 1 | 10 |
| 2 | null |
| 3 | null |
--------------

I feel like the process should be simple but haven't had any luck
using Joins or Unions to do this. Any ideas? Thanks in advance
Jul 19 '05 #1
0 874

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
6398
by: Chris Greening | last post by:
I'm seeing a very strange problem with outer joins. The example below replicates the problem: create table data1 (dim1 integer, stat1 float); create table data2 (dim1 integer, stat2 float); insert into data1 values (1,1); insert into data1 values (1,2); insert into data1 values (2,2);
0
907
by: Josh | last post by:
I have two tables with the same structure and need to compare the similar rows where they exist. That's the easy part. However, I can't figure out a way to do a calculation when a specific row only exists in one of the tables. Ex: Table A -------------- | id | value | --------------
4
4853
by: thilbert | last post by:
All, I have a perplexing problem that I hope someone can help me with. I have the following table struct: Permission ----------------- PermissionId Permission
3
10042
by: Dam | last post by:
Using SqlServer : Query 1 : SELECT def.lID as IdDefinition, TDC_AUneValeur.VALEURDERETOUR as ValeurDeRetour FROM serveur.Data_tblDEFINITIONTABLEDECODES def, serveur.Data_tblTABLEDECODEAUNEVALEUR TDC_AUneValeur where def.TYPEDETABLEDECODES = 4
6
3050
by: jao | last post by:
My company has a product in beta which uses Postgres 7.4.3. We expect to have a code freeze for our 1.0 product in March 2005. I'd really like to use Postgres 8.x in our 1.0 product. We're especially looking forward to the background writer and tablespaces. Is the 8.0 release date known? Suppose 8.0 is released in December or January. Is...
1
1127
by: Dan | last post by:
Hi All, Firstly my apologies. I am not really an access user so if this question seems fundamental I am sorry. I am trying to replicate this query using another programming language. Want I am in need to assistance with is merely clarification that it is doing what I think it is... <snip>...
4
292
by: Robert Dufour | last post by:
I have two classes , class1 and class2 In class1 I have Public Overload function Fct1(paramlist) as string some code end function Public overloads Function Fct1(otherparamlist) as string some code
7
2511
by: Gary Brown | last post by:
Hi, I have a computation intensive application that tries to update the display quite often. After a few seconds the window stops updating and the window goes blank. A breakpoint in the Paint event doesn't trigger. Further, if another window obscures the display while it is still working the display is blank after it is uncovered....
16
2623
by: techystud | last post by:
Hi, I am doing a Left Join between two views wherein the column used in the ON condition has empty string rows in the first view. while running the query the application flashes, shows #ERROR value for some of the rows and hangs. its a simple piece of code but its not working...... SELECT cstr(.), cstr(.Date) from Left outer join on...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.