?
Solved

Need query

Posted on 2011-03-01
5
Medium Priority
?
312 Views
Last Modified: 2012-05-11
Please find attachment.
Thanks in advance
0
Comment
Question by:kirannandedkar
[X]
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
  • 4
5 Comments
 

Author Comment

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

Accepted Solution

by:
reb73 earned 1000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

777 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