Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need query

Posted on 2011-03-01
5
291 Views
Last Modified: 2012-05-11
Please find attachment.
Thanks in advance
0
Comment
Question by:kirannandedkar
  • 4
5 Comments
 

Author Comment

by:kirannandedkar
ID: 35008155
Sorry forgot the attachment
Table-A.doc
0
 
LVL 25

Accepted Solution

by:
reb73 earned 250 total points
ID: 35008269
Something like this, perhaps?
Update Table_D
SET TotalAmountBase = ISNULL(A.SumBase,0) + ISNULL(B.SumBase, 0)
FROM Table_D D
LEFT JOIN (SELECT LogId, Sum(amountBase) as SumBase FROM Table_A Group By LogId) A ON A.LogId = D.LogId
LEFT JOIN (SELECT LogId, Sum(amountBase) as SumBase FROM Table_B Group By LogId) B ON B.LogId = D.LogId

Open in new window

0
 

Author Comment

by:kirannandedkar
ID: 35012041
Have you tried doing it
0
 

Author Comment

by:kirannandedkar
ID: 35015048
Really really thanks.. I hope there is no performance issue.. If you have better query than this then pls let me know otherwise i will close the question and award you points
0
 

Author Closing Comment

by:kirannandedkar
ID: 35350989
It was nice query and it helped me
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL replication over high latency link 10 60
sql, case when & top 1 14 29
SQL create line numbers for data sampling 11 28
Dynamic SQL select query 4 38
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question