SQLTeam.com | Weblogs | Forums

Sum query

Hello guys, i have two table like blue area and green area.

Table1: ID1 and ID2 are primary key.

Table2: ID3 is primary key.

How to get result like yellow area.

hi

please explain how you are joining !!! the two tables !!!
blue green

doing it is easy .. !!! IN OUT has to be transposed
using
SUM( case when IN
SUM( case when OUT

is the data you have put CORRECT !!!

DDL, sample data in easily consumable scripts and expected results will help everyone out

Notice your last post. Pivot Table, SQL Server 2008 R2

  1. You did not respond to that one to see if what others worked hard for you was correct or not?
  2. In that post the hard working people here at this site that are doing the work for you have asked you to post the data not in pictures but using DDL and DML.