• raghuldrag (7/25/2012)


    Hi friends,

    I m write procedure for the problem is

    <SNIP>

    Hello and welcome to SSC!

    I'd like to be able to help you, but it seems you've forgot to post readily consumable sample data and ddl scripts. Simply put, we haven't got enough information to help you. For example, in your query you refer to "fs_post_amt", which doesn't appear in your sample data at all.

    If you could read this article[/url] about the best way to post DDL and sample data then edit your post to include it, it would be extremely useful for the unpaid volunteers of this site.

    To get you started, here is a better way to show your sample data: -

    SELECT account,trans,date,amount

    INTO #yourTable

    FROM (VALUES

    ('E2674','Cr','02apr02',3000),

    ('R7890','Dr','06jun11',5000),

    ('E9700','Cr','7feb09',5000),

    ('R4546','Dr','7aug09',6000),

    ('E4545','Cr','9Jan11',8888),

    ('R8679','Dr','10jul11',9999))a(account,trans,date,amount);

    Anyone using SQL Server 2008 (this forum section) can execute that and have a table containing the sample data that you have shown. That way, they can provide you with tested, working solutions.

    If you don't have time to prepare this information, I'd advise you to look up aggregate functions and grouping 😉

    Thanks!


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/