SQL help

Results 1 to 3 of 3

Thread: SQL help

  1. #1
    Eric Swanson Guest

    Default SQL help

    I have an access table, and have many records with the same "project name" and there is also a field in the table called "billed miles" I want an sql query to sum all the miles for each project and display the project name and total mile only one into a table. I do not want to use multiple sql statements as I got this working already(I have over 200 projects and an sql statement for each project is a bit tedious) Is there a way to use one query to select the project name and total miles for that project and put them into a table, one line for each project? This is the code i used to get the sum, but as you can see I&#039;d have to enter put the project name in for each query: <BR>strSQL= "SELECT Sum(BILLMILES) AS summiles from AGGREGATEDRAFTING WHERE (PROJECT = &#039;Rockland&#039;) AND (DATEPOSTQC BETWEEN #" & _<BR>Request.Form("txtFirstDate") & "# AND #" & Request.Form("txtSecondDate") & "#);" <BR>set objRS = objConn.Execute(strSQL)<BR>summiles=objRS("summile s").value

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: SQL help

    try this<BR><BR>SELECT Sum(BILLMILES), PROJECT from TableName group by PROJECT <BR><BR>this will give you the total miles for each project<BR><BR>

  3. #3
    Eric Swanson Guest

    Default thanks


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts