perireddy.arikatla (9/21/2013)
But it was not fulfill my request.
select party_code, sum(inst_amt) as Total_instamt, sum(paid_amt) as paid
from @table1
where paid_date < '2012-11-27'
group by party_code
The previously posted query is very close what you asked for except for the NULL check and the wrong date. (Where does the 23rd keep coming from? Is it not < '2012-11-27')
If your requirements are not being met, you need to restate then and your desired end results so that they make sense. Stating that "It does not work" is not a good description of the problem. A picture is a start, but posting DLL and easily consumable insert statements will go a long ways in us helping you.
__________________________________________________________________________________________________________
How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/