Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sum Function

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-10-11 : 12:20:07
Dear All,
I have two table Test1 and Test2

Test1 :
Row_Date
Employee_ID
Amount

Test2 :
Row_Date
Employee_ID
Amount

Now i have to display a report like this
Row_Date,Total_Rows_In_Test1,Sum of Amount in Test1,Total_Rows_In_Test2,Sum of Amount in Test2

Please help me

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-10-11 : 12:35:48
do you have two same tables?

shouldn't you have one table with following structure:
test:
test_number
,row_Date
,Employee_ID
,Amount

what do you want to show in this report?
Go to Top of Page

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-10-11 : 12:39:46
Actually first table is Temp Table and it will always have value for one date and another table is main table
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-10-11 : 12:45:53
so table test1 is a single row table and test2 is main table. and you join both on all three columns?
Go to Top of Page

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-10-11 : 13:15:22
yes
Go to Top of Page
   

- Advertisement -