Need sql query to total rows and display in gridview
Posted on 2007-11-16
Hello, I have a billing table. Each entry in the table is accociated to a clientID. There could be multiple rows with the same ClientID. I need a sql query (I'm using ms sql 2005) that will add all the rows where the clientID=@ClientID and only display one record in a gridview, with the total of a "money" column. Example code I have is this:
Protected Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
SqlDataSource1.SelectCommand = "SELECT * FROM Billing WHERE ............."
Billing Table structure: