Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need query

Posted on 2011-03-01
5
Medium Priority
?
322 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

618 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