Yanıt inserting numbers into column

  • 24 Nisan 2012 Salı 14:02
     
     

    Hello

    i have a table sa in my database like shown below

    Here id2 is the total sum of id1 each no up to that particular row

    it means

    1 - 1

    1 - 2

    if any other one occur  again it will count again

    need to add data in id2 like this i need sql query to implement this idea

    i use a button to insert name , id1 ;


    please

Tüm Yanıtlar

  • 25 Nisan 2012 Çarşamba 07:32
     
     

    Hi SANTANA GEORGE INDIA,

    From your description, I think you would like to calculate running total values, right? In this case, I don't think we need to have the ID2 column in the table. We can calculate the running total values when retrieving data instead.

    Please refer to the following links:

    http://weblogs.sqlteam.com/mladenp/archive/2009/07/28/SQL-Server-2005-Fast-Running-Totals.aspx

    http://www.sqlteam.com/article/calculating-running-totals

    http://www.sqlmag.com/Articles/ArticleID/102251/102251.html?Ad=1


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Get or Request Code Sample from Microsoft
    If you have any feedback, please tell us.

  • 25 Nisan 2012 Çarşamba 09:51
     
     

    my problem is not simply calculating running cost of total value in id1 instead i need different number in id1 have didifferent running cost like

    1- 1

    1- 2

    1- 3

    2- 1  // just start count of new vallue in id1

    2- 2

    2- 3

    2- 4

    5 -1

    5- 2

    7- 1

    2- 5

    1- 4

    continues... and i need id2 must in my table

    here id1 is a group identity of members

    and id2 is member idendity each when each member is joining group member idendity(id2) must update automatically how i can achieve this please help...


    please

  • 25 Nisan 2012 Çarşamba 20:26
    Moderatör
     
     Yanıt

    Hello Santana George India,

    As you want only a Transact SQL query, your thread is not related to SQL Server Data Access, i propose you that a moderator moves your thread towards the T-SQL Forum where it will interest more people. As usaullay for me, i prefer to wait for the agreement of the original poster ( you ) to do the move ( except in case of emergency )

    We are waiting for your feedback to try to help you more efficiently.

    Have a nice day

    PS for Jian Kang : thanks for the 2nd link i did not know it


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    • Yanıt Olarak İşaretleyen SANTANA GEORGE 05 Haziran 2012 Salı 12:07
    •